public void InitializeValues(TankScriptableObject tankScriptableObject)
 {
     health = tankScriptableObject.health;
     healthSlider.maxValue = health;
     speed  = tankScriptableObject.speed;
     damage = tankScriptableObject.damage;
 }
 public TankModel(TankScriptableObject tankScriptableObject)
 {
     TankType   = tankScriptableObject.tankType;
     Speed      = tankScriptableObject.speed;
     Turn       = tankScriptableObject.turn;
     Health     = tankScriptableObject.health;
     BulletType = tankScriptableObject.BulletType;
 }
示例#3
0
 public void SetEnemyCharacteristics(TankScriptableObject enemytank)
 {
     Speed     = enemytank.speed;
     Rotation  = enemytank.rotation;
     Health    = enemytank.health;
     Damage    = enemytank.damage;
     TankColor = enemytank.TankColor;
 }
示例#4
0
 public TankModel(TankScriptableObject tank)
 {
     TankColor     = tank.tankColor;
     mvtSpeed      = tank.MvtSpeed;
     rotatingSpeed = tank.RotatingSpeed;
     health        = tank.Health;
     reloadTime    = tank.BulletReloadTime;
 }
示例#5
0
    public TankController CreateTank(TankScriptableObject tankScriptableObject)
    {
        randomSpawnPos = new Vector3(Random.Range(-42, 43), 2, Random.Range(39, -43));
        TankModel      tankModel      = new TankModel(tankScriptableObject);
        TankController tankController = new TankController(TankView, tankModel, randomSpawnPos, Quaternion.identity);

        return(tankController);
    }
示例#6
0
 public TankModel(TankScriptableObject tank)
 {
     MovingSpeed   = tank.movingSpeed;
     RotatingSpeed = tank.rotatingSpeed;
     Health        = tank.health;
     BulletDamage  = tank.damage;
     TankColor     = tank.tankColor;
 }
示例#7
0
 public TankModel(TankScriptableObject tankscriptableobject)
 {
     Speed    = tankscriptableobject.Speed;
     Health   = tankscriptableobject.Health;
     TankType = tankscriptableobject.tankType;
     playerID = Random.Range(1, 1000);
     //Position = TankView.transform.position;
     Debug.Log("Tank Type" + TankType);
 }
示例#8
0
 public void TankSetup(TankScriptableObject tankData)
 {
     moveSpeed          = tankData.moveSpeed;
     bulletSpeed        = tankData.bulletSpeed;
     health             = tankData.health;
     bulletDamage       = tankData.bulletDamage;
     bulletCooldownTime = tankData.bulletCooldownTime;
     startPos           = transform.position;
     myTankData         = tankData;
 }
示例#9
0
    public TankModel(TankScriptableObject tankScriptableObject)
    {
        this.tankScriptableObject = tankScriptableObject;

        TankType = tankScriptableObject.TankType;
        Speed    = (int)tankScriptableObject.Speed;
        Health   = tankScriptableObject.Health;

        playerId = Random.Range(1, 100000);
    }
        private void CreateNewObject(TankScriptableObject tankScriptableObject)

        {
            TankView  tankView;
            TankModel tankModel = new TankModel(tankScriptableObject.health,
                                                tankScriptableObject.force,
                                                tankScriptableObject.torque, tankScriptableObject.bulletVariants);

            tankView = GameObject.Instantiate <TankView>(tankViewPrefab);
            tankView.ColorSelector(tankScriptableObject.tankColor);
            TankController tankController = new TankController(tankModel, tankView);
        }
示例#11
0
    private TankController CreateNewTank(int index)
    {
        TankScriptableObject tankScriptableObject = tankList.tanks[index];

        Debug.Log("Creating Tank with type: " + tankScriptableObject.TankName);

        TankModel model = new TankModel(tankScriptableObject);
        //TankController tank = new TankController(model, tankView);
        TankController tank = servicePoolTank.GetTank(model, tankView);

        tank.Enable();
        return(tank);
    }
示例#12
0
        private TankController CreateTank(int index)
        {
            //TankScriptableObject tankScriptableObject = tankConfigurations[2];

            TankScriptableObject tankScriptableObject = tankList.tanks[index];

            Debug.Log("Tank Type" + tankScriptableObject.tankName);

            TankModel      model = new TankModel(tankScriptableObject);
            TankController tank  = new TankController(model, tankView);

            return(tank);
        }
        /// <summary>
        /// Создать на сцене танк согласно описанию
        /// </summary>
        /// <param name="description">Скриптовый объект с описанием</param>
        private void SpawnPlayerTank(TankScriptableObject description)
        {
            //Копируем описание
            var descriptionInstance = Instantiate(description);

            TankCore newTank = _tankPool;

            if (_tankPool.gameObject.activeInHierarchy == false)
            {
                newTank.transform.position = new Vector3(Random.Range(-MaximumSpawnPosition, MaximumSpawnPosition), 1.5f, Random.Range(-MaximumSpawnPosition, MaximumSpawnPosition));
                newTank.TankDescription    = descriptionInstance;
                newTank.gameObject.SetActive(true);

                PlayerSpawnedEvent.Invoke();
                PlayerSpawnedEvent.TransformInvoke(newTank.transform);
            }
            else
            {
                Debug.Log("Танк уже создан на сцене");
            }
        }