public void pickMateButton(MonsterUnit m)
 {
     Monster t = m.getUnit();
     unitMonster = new Monster(unitMonster, t);
     setColors();
     updateUnitText();
 }
Exemple #2
0
 public void enter(MonsterUnit enemy)
 {
     self          = enemy;
     target        = GameObject.FindGameObjectWithTag("Player").transform;
     selfRigidbody = self.GetComponent <Rigidbody>();
     attackHandler(self.centerPoint.spawnMonsterType.name);
 }
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Monster" && inputHandler.Attack_Num > 0)
        {
            if (fps.swordenter == true)
            {
                int         attackNum = (inputHandler.Attack_Num > 3) ? 3 : inputHandler.Attack_Num;
                MonsterUnit unit      = other.GetComponent <MonsterUnit>();

                //creating the effect
                Vector3 MonsterPosition = other.gameObject.transform.position;
                Vector3 PlayerPosition  = gameObject.transform.position;
                Instantiate(database1, (MonsterPosition + PlayerPosition) / 2, other.gameObject.transform.rotation);
                //	Instantiate(swordMark, Markhere.transform.position, Markhere.transform.rotation);
                GameObject SM = Instantiate(swordMark, fps.heresST[fps.attacklevel].transform.position, fps.heresST[fps.attacklevel].transform.rotation) as GameObject;
                SM.transform.parent = fps.heresST[fps.attacklevel].transform;
                print(fps.heresST[fps.attacklevel]);
                //GameObject.Find ("Main Camera").GetComponent<MotionBlur>().enabled = true ;  //啟動模糊


                float percentage = damageData.GetField("Player").GetField(attackNum.ToString()).n / 100;
                unit.underAttack(Mathf.Abs(damage * percentage), attackNum);
                inputHandler.anim.speed = 0.7f;
            }
        }
    }
Exemple #4
0
 public State(MonoBehaviour mono)
 {
     this.Mono = mono;
     monster   = Mono.GetComponent <MonsterUnit>();
     state     = Mono.GetComponent <MonsterState>();
     agent     = mono.GetComponent <NavMeshAgent>();
 }
Exemple #5
0
        public void enter(MonsterUnit enemy)
        {
            self = enemy;
            self.selfRigidbody.isKinematic = true;

            StartCoroutine(WaitAndDie(5.0F));
        }
Exemple #6
0
 public void enter(MonsterUnit enemy)
 {
     self = enemy;
     setWayPoint();
     float ranSecond = Random.Range(1, 10);
     InvokeRepeating("setWayPoint", ranSecond, 5F);
 }
Exemple #7
0
 public void enter(MonsterUnit enemy)
 {
     self = enemy;
     target = GameObject.FindGameObjectWithTag("Player").transform;
     selfRigidbody = self.GetComponent<Rigidbody>();
     attackHandler(self.centerPoint.spawnMonsterType.name);
 }
Exemple #8
0
        private void Spawn(MonsterStats monster)
        {
            //int spawnNumPerTime = Random.Range(1, 4);

            //for (int s = 0; s < spawnNumPerTime; s++) {
            //    //Pick monster type
            //    MonsterStats randomMonster = _monsterUnits[Random.Range(0, monsterLength)];

            //Pick start position
            int      randomX        = Random.Range(0, _entranceComponent.fullSize.x);
            TileNode randomTileNode = _entranceComponent.tilemapReader.nodes[randomX, _entranceComponent.fullSize.y - 1];

            GameObject monsterObject = PoolManager.instance.ReuseObject(VariableFlag.Pooling.MonsterID);

            if (monsterObject != null)
            {
                BaseStrategy strategy = _strategyMapper.GetStrategy(monster.strategy);

                MonsterUnit unit = monsterObject.GetComponent <MonsterUnit>();
                unit.transform.position = randomTileNode.WorldSpace;
                unit.SetUp(monster, strategy, _mapGrid, _mapHolder, _gameUnitManager.gameDamageManager);
                _gameUnitManager.AddUnit(unit);
            }
            //}
        }
Exemple #9
0
        public void enter(MonsterUnit enemy)
        {
            self = enemy;
            self.selfRigidbody.isKinematic = true;

            StartCoroutine(WaitAndDie(5.0F));
        }
Exemple #10
0
        public void enter(MonsterUnit enemy)
        {
            self = enemy;
            setWayPoint();
            float ranSecond = Random.Range(1, 10);

            InvokeRepeating("setWayPoint", ranSecond, 5F);
        }
Exemple #11
0
        public void SetUp(MonsterUnit unit, int uniqueID, MonsterStats monsterStat, MapGrid mapGrid, GameDamageManager gameDamageManager)
        {
            this.unit               = unit;
            this.monsterStat        = monsterStat;
            this.mapGrid            = mapGrid;
            this._gameDamageManager = gameDamageManager;
            this._uniqueID          = uniqueID;

            if (!AttackTimeDict.ContainsKey(uniqueID))
            {
                AttackTimeDict.Add(uniqueID, 0);
            }
        }
Exemple #12
0
    public void CompleteGenerate(bool monsters = true)
    {
        if (monsters)
        {
            List <Transform> possiblePositions = new List <Transform>(monsterPositions);
            int monsterCount = Random.Range(minMonsters, maxMonsters + 1);
            for (int i = 0; i < monsterCount && i < monsterPositions.Length; i++)
            {
                int       index = Random.Range(0, possiblePositions.Count);
                Transform t     = possiblePositions[index];
                possiblePositions.RemoveAt(index);

                MonsterUnit prefab = monsterPrefabs[Random.Range(0, monsterPrefabs.Length)];
                MonsterUnit unit   = Instantiate(prefab, t.position, t.rotation);
                unit.GetComponent <UnitMovementController>().Enable();
                unit.transform.parent = t;
                spawnedMonsters.Add(unit);
            }
        }
        GetComponentInChildren <NavMeshLink>(true).gameObject.SetActive(true);
    }
Exemple #13
0
    private void GenerateMonster(TileNode tileNode)
    {
        if (_monsterStats == null || _monsterStats.Count <= 0)
        {
            return;
        }

        MonsterStats monsterStats = _monsterStats[0];

        GameObject monsterObject = Pooling.PoolManager.instance.ReuseObject(VariableFlag.Pooling.MonsterID);

        if (monsterObject != null)
        {
            monsterObject.transform.position = tileNode.WorldSpace;
            BaseStrategy strategy = _strategyMapper.GetStrategy(monsterStats.strategy);

            MonsterUnit dummyUnit = monsterObject.GetComponent <MonsterUnit>();
            dummyUnit.SetUp(monsterStats, strategy, _mapGrid, _mapHolder, _gameUnitManager.gameDamageManager);

            _gameUnitManager.AddUnit(dummyUnit);
        }
    }
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     m_unit      = animator.GetComponent <MonsterUnit>();
     m_transform = animator.GetComponent <Transform>();
 }
Exemple #15
0
 public void enter(MonsterUnit enemy)
 {
     self = enemy;
     target = GameObject.FindGameObjectWithTag("Player").transform;
 }
Exemple #16
0
 public void enter(MonsterUnit enemy)
 {
     self   = enemy;
     target = GameObject.FindGameObjectWithTag("Player").transform;
 }