Beispiel #1
0
 public TankModel(TankScriptableObjects tankScriptableObjects)
 {
     this.TankType   = tankScriptableObjects.TankType;
     this.Speed      = (int)tankScriptableObjects.Speed;
     this.Health     = (int)tankScriptableObjects.Health;
     this.BulletType = tankScriptableObjects.bullet;
     this.colorType  = tankScriptableObjects.color;
     this.myID       = tankScriptableObjects.myID;
 }
Beispiel #2
0
    private TankController SpawnTank()
    {
        TankScriptableObjects tankScriptableObject = tankConfigs[1];
        TankModel             TankModel            = new TankModel(tankScriptableObject);

        // TankModel TankModel = new TankModel(TankType.None, 0.1f, 100f, 4);
        tankController = new TankController(TankModel, tankPrefab);

        return(tankController);
    }
Beispiel #3
0
        public TankController CreateNewTank(int combination)
        {
            //tankScriptableObject = tankScriptableObjectList.tanks[Random.Range(0,3)];
            //Extract number from tankObjectlist and apply that value as TSO.
            this.combinationCreation = combination;


            tankScriptableObject = tankScriptableObjectList.tanks[combination];
            tankModel            = new TankModel(tankScriptableObject);


            //initialize the value of TC.
            tankController = new TankController(tankModel, tankView);
            tankLists.Add(tankController);
            return(tankController);
        }
Beispiel #4
0
    public void SetBaseValues(TankScriptableObjects configs)
    {
        speed     = configs.speed;
        health    = configs.health;
        attack    = configs.attack;
        tankColor = configs.tankColor;

        foreach (MeshRenderer mesh in meshes)
        {
            if (tankColor == TankColor.Blue)
            {
                mesh.material.color = Color.blue;
            }
            else if (tankColor == TankColor.Red)
            {
                mesh.material.color = Color.red;
            }
        }
    }
Beispiel #5
0
        private void Start()
        {
            tankScriptableObject = ScriptableObject.CreateInstance <TankScriptableObjects>();

            //combinationCreation = UnityEngine.Random.Range(1,3);
            combinationCreation = 3;

            //Added tank to the list.
            CreateNewTank(combinationCreation);

            //Service initilization methods.
            SceneService.Instance.followPlayer();
            CameraFollow.Instance.followPlayerCamera();
            HealthBar.Instance.followHealthPlayer();



            Debug.Log("MyID is " + tankLists[0].TankModel.myID);
            //Debug.Log(tankLists.Count);
            //Debug.Log("The tank type is " + tankLists[0].getModel().TankType);
        }
 public TankModel(TankScriptableObjects tankScriptableObject)
 {
     tankType = tankScriptableObject.TankType;
     Speed    = tankScriptableObject.Speed;
     Health   = tankScriptableObject.Health;
 }