Example #1
0
 public void InitInGame()
 {
     ver    = StaticStrings.Vertical;
     hor    = StaticStrings.Horizontal;
     anim   = GetComponent <Animator>();
     player = GetComponentInChildren <B_Player>();
     player.initializeCanvas();
     //dependency with statemanager
     states.init();
     camerahandler = GetComponentInChildren <Camerahandler>();
     camerahandler.Init(this);
     playerActions = new PlayerActions(player, this, anim);
     player.Helper.INITIALIZETARGETEVENT(this);
     reciveTrget(playerActions.targets[0]);
     bs = GetComponentInChildren <BulletSpawner>();
     bs.INITIALIZING(player);
     player.reciveAnimator(anim);
     isInit = true;
     player.assignWeapons(weaponModel, SpecialWeaponModel);
     isfrozen = false;
 }
Example #2
0
    public void INIT(B_Player p)
    {
        anim   = GetComponent <Animator>();
        player = p;
        ag     = GetComponent <NavMeshAgent>();
        status = new STATUS();
        int selecting = UnityEngine.Random.Range(0, 3);

        switch (selecting)
        {
        case 0: aiType = CpuType.aggressive; break;

        case 1: aiType = CpuType.balanced; break;

        case 2: aiType = CpuType.defensive; break;

        default: aiType = CpuType.aggressive; break;
        }
        Weapon wp = new Gun(100, 25, 1f, 1, 1, 1);

        status.changeWeapon(wp);
        player.Tower.gameObject.AddComponent <AttackingDetector>();
        player.Tower.GetComponent <AttackingDetector>().brainConnetting(this);
        cpu = new PlayerCPU(anim, player, ag, status, this.transform);
        cpu.findNewTarget();
        ag.speed = 20;
        GetComponentInChildren <BulletSpawner>().INITIALIZING(player);
        player.reciveAnimator(anim);
        initialized = true;
        tm          = player.team;
        player.onDead();
        isfrozen = false;
        rb       = GetComponent <Rigidbody>();
        coll     = GetComponent <CapsuleCollider>();
        BulletSpawner spawner = GetComponentInChildren <BulletSpawner>();

        spawner.INITIALIZING(player);
    }