Ejemplo n.º 1
0
    /**
     * There is a debug code.
     * incomplete:: shld be read settings file
     */
    protected override void Start()
    {
        base.Start();
        Debug.Log("사람 나타남");
        hpDB = new int[6] {
            31, 37, 64, 72, 106, 119
        };
        atkDB = new int[6] {
            2, 2, 4, 5, 7, 9
        };
        defDB = new int[6] {
            1, 1, 3, 4, 6, 7
        };
        dropDB = new int[6] {
            10, 10, 15, 15, 20, 20
        };
        nDropDB = new int[6] {
            20, 20, 30, 30, 40, 40
        };

        level         = boardManager.WhichFloor;
        attack        = atkDB[level]; //shld be decided by level and setting file
        defense       = defDB[level];
        maxhp         = hpDB[level];
        hp            = maxhp;
        debuffPercent = 0.0f;
        enemyAction   = new EnemyAction(this);
        debuff        = null;
        player        = GameObject.Find("Player").GetComponent <Player>();
    }
Ejemplo n.º 2
0
    public override void Enter()
    {
        base.Enter();
        _animator     = _go.GetComponent <Animator>();
        _enemyAction  = (EnemyAction)_attributes.Find(x => x.GetType() == typeof(EnemyAction));
        _aiController = (AIController)_attributes.Find(x => x.GetType() == typeof(AIController));

        _playerAnimator = GameObject.FindGameObjectWithTag("Player").GetComponent <Animator>();


        _enemyAction.action = EnemyAction.EnemyActionType.Injured;

        foreach (AnimationClip clip in _animator.runtimeAnimatorController.animationClips)
        {
            if (!clip.name.Contains("takeDMG"))
            {
                continue;
            }

            _injuredAction = new AnimationAction(clip);
            _animTime      = _injuredAction.AnimationClipLength * 2;
        }

        _played = false;

        /*
         * if (!_playerAnimator.GetCurrentAnimatorStateInfo(0).IsTag("HT"))
         *  _animTime /= 4;*/
    }
Ejemplo n.º 3
0
    public void gotScared()
    {
        if (enemyAction == EnemyAction.Walking)
        {
            enemyAction = EnemyAction.Scared;
            animator.SetBool("Scared", true);

            rgdb.velocity = new Vector2(0, 0);
        }
    }
Ejemplo n.º 4
0
 public void DelTransition(EnemyTrans trans, EnemyAction actionID)
 {
     if (!map.ContainsKey(trans))
     {
         Debug.Log("failure,The Enemy Transition:" + trans + " has not existed! ");
         return;
     }
     map.Remove(trans);
     Debug.Log("Success,The Enemy Transition has removed!");
 }
Ejemplo n.º 5
0
 public void AddTransition(EnemyTrans trans, EnemyAction actionID)
 {
     if (map.ContainsKey(trans))
     {
         Debug.Log("failure,The Enemy Transition has existed! ");
         return;
     }
     map.Add(trans, actionID);
     Debug.Log("Success,The Enemy Transition:" + trans + " has added!");
 }
Ejemplo n.º 6
0
    void LateUpdate()
    {
        //base.LateUpdate();

        ai_state.LateUpdateState();

        // stop action on state change
        if (is_state_changed)
        {
            if (current_action != null)
            {
                if (current_action == next_action)
                    current_action.OnRestart();
                else
                    current_action.OnStop();
            }
        }

        current_action = next_action;
        is_state_changed = false;
    }
Ejemplo n.º 7
0
 private void ChangeState(ai_states next_state, EnemyAction action)
 {
     next_action = action;
     ai_state.ChangeState(next_state);
     is_state_changed = true;
 }
Ejemplo n.º 8
0
 private void setAction(EnemyData.Behavior behavior)
 {
     if (behavior == EnemyData.Behavior.DoNothing)
         currentAction = doNothing;
     else if (behavior == EnemyData.Behavior.Follow)
         currentAction = follow;
     else if (behavior == EnemyData.Behavior.RunAway)
         currentAction = runAway;
     else if (behavior == EnemyData.Behavior.Die)
         currentAction = die;
 }
Ejemplo n.º 9
0
 public EnemyReturn(EnemyAction action, Object[] values)
 {
     this.action = action;
         this.values = values;
 }
Ejemplo n.º 10
0
 public virtual void Setup()
 {
     _action = new EnemyAction();
 }
Ejemplo n.º 11
0
 public void refreshText(EnemyAction ea)
 {
     panelUIEdit.transform.FindChild("LabelAction").GetComponent<UILabel>().text = convertMoveToString(ea.state);
     panelUIEdit.transform.FindChild("Input").GetComponent<UIInput>().text =  ea.timeWait.ToString("0.0");
 }