Exemplo n.º 1
0
    void OnGUI()
    {
        GUILayout.BeginVertical();
        GUILayout.ExpandHeight(true);

        var gameobject = Selection.activeGameObject;

        if (gameobject != null)
        {
            GUILayout.Label(gameobject.name, EditorStyles.boldLabel);

            var customAnimationContrller = gameobject.GetComponent <CustomAnimationController>();
            if (customAnimationContrller != null &&
                customAnimationContrller.ActionList != null)
            {
                _lastSellectedController = customAnimationContrller;
                for (int i = 0; i < customAnimationContrller.ActionList.Count; ++i)
                {
                    var action = customAnimationContrller.ActionList[i];

                    GUILayout.Label(action.GetType().ToString(), EditorStyles.boldLabel);
                    if (GUILayout.Button("Remove Action", GUILayout.Width(100)))
                    {
                        if (customAnimationContrller.ActionList.Remove(action))
                        {
                            --i;
                            continue;
                        }
                    }
                    try
                    {
                        foreach (var property in action.GetType().GetProperties())
                        {
                            var propertyValue = property.GetValue(action, null);
                            if (propertyValue is float)
                            {
                                EditorGUILayout.FloatField(property.Name.ToString(), (float)propertyValue);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Debug.Log(ex.Message);
                    }
                }

                GUILayout.BeginHorizontal();
                GUILayout.ExpandWidth(true);
                if (GUILayout.Button("Add Action"))
                {
                    AddActionWindow.ShowWindow();
                }
                GUILayout.ExpandWidth(false);
                GUILayout.EndHorizontal();
            }
        }

        GUILayout.ExpandHeight(false);
        GUILayout.EndVertical();
    }
Exemplo n.º 2
0
 private void Awake()
 {
     CustomAnimController = GetComponent <CustomAnimationController>();
     _animInfos           = new AnimationInfos(CustomAnimController);
     _thisObject          = GetComponent <BaseObject>();
     LoadResource();
 }
Exemplo n.º 3
0
    public override void OnBuffRemove()
    {
        CustomAnimationController animationController = GetAnimationController();

        if (animationController != null)
        {
            animationController.SetAnimatorSpeed(currentAnimatorSpeed);
        }
        holder.statusManager.RemoveStatus(RoleStatus.STUN);
    }
Exemplo n.º 4
0
 protected virtual void Start()
 {
     TargetsInAttackArea         = new List <GameObject>();
     Rigidbody                   = GetComponent <Rigidbody>();
     AnimationClips              = AnimationClipsLoader.GetAnimationClips(gameObject.tag, "Movement");
     MovementAnimationDictionary = InitAnimationsDictionary();
     PlayableGraphObject         = new PlayableGraph();
     AnimationBody               = HelperTools.FindObjectInChildWithTag(gameObject, "BodyModel");
     CustomAnimationController   = new CustomAnimationController(AnimationBody, AnimationBody.GetComponent <Animator>(), MovementAnimationDictionary, PlayableGraphObject);
 }
Exemplo n.º 5
0
    public override void OnBuffRemove()
    {
        CustomAnimationController animationController = GetAnimationController();

        if (animationController != null)
        {
            animationController.SetAnimatorSpeed(currentAnimatorSpeed);
        }
        holder.GetComponent <Rigidbody>().isKinematic = false;
        holder.statusManager.RemoveStatus(RoleStatus.FROZEN);
    }
Exemplo n.º 6
0
    //private float currentMoveSpeed;
    //private float currentAngularSpeed;

    public override void OnBuffApply()
    {
        CustomAnimationController animationController = GetAnimationController();

        if (animationController != null)
        {
            currentAnimatorSpeed = animationController.animator.speed;
            animationController.SetAnimatorSpeed(0.2f);
        }

        holder.statusManager.AddStatus(RoleStatus.STUN);
    }
Exemplo n.º 7
0
 protected virtual void FixedUpdate()
 {
     if (lastAnimState != AnimationState)
     {
         CustomAnimationController.ChangeWeight(AnimationState, weight);
         weight += 0.1f;
     }
     if (weight >= 1.0f)
     {
         CustomAnimationController.ChangeWeight(AnimationState, 1.0f);
         weight        = 0.0f;
         lastAnimState = AnimationState;
     }
 }
Exemplo n.º 8
0
    public virtual void Awake()
    {
        baseAgentController = transform.GetComponent <BaseAgentController>();
        GameObject gameManager = GameObject.FindGameObjectWithTag("GameController");

        prafabHolder        = gameManager.GetComponent <PrafabHolder>();
        aiUtils             = gameManager.GetComponentInChildren <AIUtils>();
        animationController = transform.GetComponentInChildren <CustomAnimationController>();
        eventHelper         = transform.GetComponentInChildren <SimpleEventHelper>();
        shootPoint          = aiUtils.GetShootPoint(transform);

        player      = GameObject.FindGameObjectWithTag("Player");
        currentRole = GetComponent <Enemy>();
        currentRole.statusManager.notifyStatusChange += OnStatusChange;
        eventHelper.notifyGetHit += OnGetHit;

        currentState   = AIState.IDLE;
        stateStartTime = Time.time;
        progress       = AIProgress.END;
        resetPatrolPoint();
    }
Exemplo n.º 9
0
    //private float currentMoveSpeed;
    //private float currentAngularSpeed;

    public override void OnBuffApply()
    {
        CustomAnimationController animationController = GetAnimationController();

        if (animationController != null)
        {
            currentAnimatorSpeed = animationController.animator.speed;
            animationController.SetAnimatorSpeed(0);
        }

        holder.statusManager.AddStatus(RoleStatus.FROZEN);
        holder.GetComponent <Rigidbody>().isKinematic = true;

        Transform     model         = gameObject.transform.parent.GetChild(0);
        ShaderChanger shaderChanger = model.gameObject.AddComponent <ShaderChanger>();

        shaderChanger.newShader        = prafabHolder.GetShader("ice");
        shaderChanger.timeToChangeBack = duration;

        ShowEffect(OtherEffects[0], true);
        ShowEffect(OtherEffects[1], true);
    }
Exemplo n.º 10
0
 public AnimationInfos(CustomAnimationController controller)
 {
     _animController = controller;
 }