コード例 #1
0
    // Use this for initialization

    void Start()
    {
        //if (unitFramePrefab != null) unitFrame = GameObject.Instantiate(unitFramePrefab, transform);
        monsters.Add(this);
        if (GetComponent <RewardGiver>().generatedMonster)
        {
            return;
        }
        int spiritRoll = Random.Range(0, 200);

        if (spiritRoll < 10)
        {
            var ability = AbilityGenerator.Generate(GetComponent <MonsterScaler>().level);
            if (ability is PassiveAbility passiveAbility)
            {
                GetComponent <AbilityUser>().soulGemPassive = passiveAbility;
            }
            else
            {
                GetComponent <AbilityUser>().soulGemActives.Add((ActiveAbility)ability);
            }
            if (GetComponent <AbilityUser>().soulGemPassive != null)
            {
                GetComponent <AbilityUser>().AddPassive(GetComponent <AbilityUser>().soulGemPassive);
            }
        }
        renderers = GetComponentsInChildren <Renderer>();
        monsterAi = GetComponent <MonsterAi>();
        var nma = GetComponent <NavMeshAgent>();

        nma.speed       *= 3; // speed multiplier to make game harder
        nma.acceleration = nma.speed * 1.5f;
        nma.angularSpeed = 3600f;
    }
コード例 #2
0
 // Use this for initialization
 protected override void Start()
 {
     if (IsModel)
     {
         PreloadHurtShader();
         return;
     }
     _roleInfo = new MonsterInfo(RoleId);
     base.Start();
     _ai = new MonsterAi(this);
 }
コード例 #3
0
ファイル: ControlArrow.cs プロジェクト: darkmoon923/WIZZ
    // Update is called once per frame
    void Update()
    {
        Vector2 CurrentPosition = new Vector2(transform.position.x, transform.position.y);
        Vector2 NewPosition     = CurrentPosition + Velocity * Time.deltaTime;

        Debug.DrawLine(CurrentPosition, NewPosition, Color.red);

        RaycastHit2D[] Hits = Physics2D.LinecastAll(CurrentPosition, NewPosition);

        foreach (RaycastHit2D hit in Hits)
        {
            GameObject other = hit.collider.gameObject;
            if (other != Shooter)
            {
                if (other.CompareTag("Player"))
                {
                    Destroy(gameObject);
                    Debug.Log(other);
                    break;
                }

                if (other.CompareTag("Wall"))
                {
                    Destroy(gameObject);
                    break;
                }

                if (other.CompareTag("Monster"))
                {
                    MonsterAi monster = other.GetComponent <MonsterAi>();
                    if (!(monster is null) && !monster.HasDied)
                    {
                        Destroy(gameObject);
                        monster.Health--;
                        break;
                    }
                }
            }
        }
        transform.position = NewPosition;
    }
コード例 #4
0
ファイル: LiveMonster.cs プロジェクト: jayrulez/TOMClassic
        public LiveMonster(int level, Monster mon, Point point, bool isLeft)
        {
            Id     = World.WorldInfoManager.GetCardFakeId();
            Level  = level;
            Avatar = mon;
            Avatar.UpgradeToLevel(level);

            Position     = point;
            IsLeft       = isLeft;
            Action       = 0;
            roundPast    = 0;
            HpBar        = new HpBar(this);
            SkillManager = new SkillManager(this);
            AttackType   = (int)CardElements.None;
            CanAttack    = true;

            BuffManager        = new BuffManager(this);
            aiController       = new MonsterAi(this);
            LiveMonsterToolTip = new LiveMonsterToolTip(this);

            SetBasicData();
            HpBar.SetHp(Avatar.Hp);
            MonsterCoverBox = new MonsterCoverBox(this);
        }