您最多选择25个主题
主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
此仓库已存档。您可以查看文件和克隆,但不能推送或创建工单/合并请求。
|
- using System;
- using System.Collections.Generic;
- using UnityEngine;
-
- namespace coa4u
- {
- class ActionSwitchState : ActionInstant
- {
- string stateName;
- int stateIndex;
-
- public ActionSwitchState(int targetIndex)
- : base()
- {
- stateIndex = targetIndex;
- }
-
- public ActionSwitchState(string targetName)
- : base()
- {
- stateName = targetName;
- }
-
- public override void Start()
- {
- base.Start();
- if (!(target is SeqActor))
- {
- throw new Exception("Target is not capable of switching states.");
- }
- if (stateIndex != null)
- {
- ((SeqActor)target).SetState(stateIndex);
- }
- else
- {
- ((SeqActor)target).SetState(stateName);
- }
- }
- }
- }
|