示例#1
0
    protected override void PerformAction(float timeStep)
    {
        base.PerformAction(timeStep);
        if (!newValueAssigned && (agentComponent != null))
        {
            switch (targetProperty)
            {
            case AgentProperty.Name:
                agentComponent.SetCurrentName(newStringValue);
                newValueAssigned = true;
                break;

            case AgentProperty.Colliders:
                agentComponent.ToggleColliders(newBoolValue);
                newValueAssigned = true;
                break;

            case AgentProperty.MaxSpeed:
                if (!tryToCorrect)
                {
                    agentComponent.ForceFinalMaxSpeedTo(newFloatValue);
                }
                else
                {
                    agentComponent.CorrectFinalStats();
                }
                newValueAssigned = true;
                break;

            case AgentProperty.DamageAcceptance:
                agentComponent.ToggleDamageAcceptance(newBoolValue);
                newValueAssigned = true;
                break;

            case AgentProperty.FacingSide:
                agentComponent.SetFacingSide(newBoolValue);
                newValueAssigned = true;
                break;

            case AgentProperty.TransactionsTrigger:
                agentComponent.ToggleTransactionsTrigger(newBoolValue);
                newValueAssigned = true;
                break;
            }
        }
    }