public override Activity Tick(Actor self)
        {
            // Do turn first, if needed.
            if (ChildActivity != null)
            {
                ChildActivity = ActivityUtils.RunActivityTick(self, ChildActivity);
                return(this);
            }

            // Without this, turn for facing deploy angle will be canceled and immediately deploy!
            if (IsCanceling)
            {
                return(NextActivity);
            }

            if (IsInterruptible)
            {
                IsInterruptible = false;                 // must DEPLOY from now.
                deploy.Deploy();
                return(this);
            }

            // Wait for deployment
            if (deploy.DeployState == DeployState.Deploying)
            {
                return(this);
            }

            // Failed or success, we are going to NextActivity.
            // Deploy() at the first run would have put DeployState == Deploying so
            // if we are back to DeployState.Undeployed, it means deploy failure.
            // Parent activity will see the status and will take appropriate action.
            return(NextActivity);
        }
        public override bool Tick(Actor self)
        {
            // Wait for deployment
            if (deployment.DeployState == DeployState.Deploying || deployment.DeployState == DeployState.Undeploying)
            {
                return(false);
            }

            if (initiated)
            {
                return(true);
            }

            if (deployment.DeployState == DeployState.Undeployed)
            {
                deployment.Deploy();
            }
            else
            {
                deployment.Undeploy();
            }

            initiated = true;
            return(false);
        }
示例#3
0
        public override Activity Tick(Actor self)
        {
            // Wait for deployment
            if (deployment.DeployState == DeployState.Deploying || deployment.DeployState == DeployState.Undeploying)
            {
                return(this);
            }

            if (initiated)
            {
                return(NextActivity);
            }

            if (deployment.DeployState == DeployState.Undeployed)
            {
                deployment.Deploy();
            }
            else
            {
                deployment.Undeploy();
            }

            initiated = true;
            return(this);
        }