Example #1
0
    void OnCollisionEnter(Collision other)
    {
        if (other.gameObject.tag == "Enemy" || other.gameObject.tag == "Player")
        {
            data = other.gameObject.GetComponent <TankData>();

            if (gameObject.tag == "RateOfire")
            {
                data.delay -= 0.25f;
                AudioSource.PlayClipAtPoint(powUpSound, this.transform.position, PlayerPrefs.GetFloat("sfxVolume"));
                transform.localPosition = new Vector3(0, -5, 0);
                respawnTime             = Time.time + respawnDelay;
            }
            if (gameObject.tag == "Health")
            {
                data.health += 10;
                if (data.health > data.maxHealth)
                {
                    data.health = data.maxHealth;
                }
                AudioSource.PlayClipAtPoint(powUpSound, this.transform.position, PlayerPrefs.GetFloat("sfxVolume"));
                transform.localPosition = new Vector3(0, -5, 0);
                respawnTime             = Time.time + respawnDelay;
            }
            if (gameObject.tag == "Speed")
            {
                data.turnSpeed    += 2;
                data.moveSpeed    += 3;
                data.ReverseSpeed += 3;
                AudioSource.PlayClipAtPoint(powUpSound, this.transform.position, PlayerPrefs.GetFloat("sfxVolume"));
                transform.localPosition = new Vector3(0, -5, 0);
                respawnTime             = Time.time + respawnDelay;
            }
            respawnNow = false;
        }
    }
Example #2
0
    void DrawDefaultTexture(TankData myTarget)
    {
        GUILayout.Space(10);
        GUILayout.Label("Textury:", EditorStyles.boldLabel);

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Tekstura kadłuba czołgu:");
        EditorGUILayout.Toggle(true);
        myTarget.hullTexture = (Sprite)EditorGUILayout.ObjectField(myTarget.hullTexture, typeof(Sprite), true);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Tekstura wieży czołgu:");
        myTarget.czyPosiadamLufe = EditorGUILayout.Toggle(myTarget.czyPosiadamLufe);
        if (myTarget.czyPosiadamLufe)
        {
            myTarget.turretTexture = (Sprite)EditorGUILayout.ObjectField(myTarget.turretTexture, typeof(Sprite), true);
        }
        else
        {
            myTarget.turretTexture = null;
        }
        EditorGUILayout.EndHorizontal();
    }
    public override void InitControll(TankData data)
    {
        base.InitControll(data);

        IsEnable = true;
    }
Example #4
0
 // Start is called before the first frame update
 void Start()
 {
     data         = GetComponent <TankData>();
     lastFireTime = Time.time;
 }
Example #5
0
 // Start is called before the first frame update
 void Start()
 {
     data = GetComponent <TankData>();
     characterController = GetComponent <CharacterController>();
 }
Example #6
0
 // Start is called before the first frame update
 void Start()
 {
     data  = GetComponent <TankData>();
     motor = GetComponent <TankMotor>();
 }
 // Start is called before the first frame update
 void Start()
 {
     player = GameObject.FindWithTag("Player");
     data   = player.GetComponent <TankData>();
 }
Example #8
0
 // Use this for initialization
 void Start()
 {
     score = GetComponent <Text>();
     data  = GetComponentInParent <TankData>();
     OverLayScore();
 }
Example #9
0
 //Sends data to other scripts
 public void Initilization(TankData data)
 {
     _tankData = data;
 }
Example #10
0
 public void OnDeactivate(TankData target)
 {
 }
Example #11
0
 void Start()
 {
     data = tank.GetComponent <TankData>();
 }
 // Start is called before the first frame update
 void Start()
 {
     data     = GetComponent <TankData>();
     powerups = new List <Powerup>();
 }
Example #13
0
 void Awake()
 {
     //attaching scripts and objects.
     data = GetComponent <TankData>();
 }
Example #14
0
 // Use this for initialization
 void Start()
 {
     scoreText = GetComponent <Text>();
     data      = GetComponentInParent <TankData>();
     setUIScore();
 }
 public override void OnActivated(TankData data)
 {
     data.missileCooldownMax -= Firerate;
     base.OnActivated(data);
 }
 void Start()
 {
     CharacterController = gameObject.GetComponent <CharacterController>();
     tf   = gameObject.GetComponent <Transform>();
     data = gameObject.GetComponent <TankData>();
 }
Example #17
0
 public virtual void OnActivated(TankData data)
 {
 }
Example #18
0
 // Start is called before the first frame update
 void Start()
 {
     data    = gameObject.GetComponent <TankData>();
     motor   = gameObject.GetComponent <TankMotor>();
     shooter = gameObject.GetComponent <TankShooter>();
 }
Example #19
0
 // Use this for initialization
 void Start()
 {
     motor      = gameObject.GetComponent <TankMotor>();
     speedInfo  = gameObject.GetComponent <TankData>();
     ammunition = gameObject.GetComponent <TankData>().Ammo;
 }
Example #20
0
    [HideInInspector] public bool cannonLoaded = true; // Bool is true when the timer expires, allowing the cannon can be fired again

    void Start()
    {
        tf             = GetComponent <Transform>();
        tankData       = GetComponentInParent <TankData>();
        lastCannonFire = Time.time; // Last cannon is set to Time.time by default
    }
 // Start is called before the first frame update
 void Start()
 {
     data  = gameObject.GetComponent <TankData>();
     motor = gameObject.GetComponent <TankMotor>();
     tf    = gameObject.GetComponent <Transform>();
 }
 /// <summary>
 /// 初始化
 /// </summary>
 public override void OnInit()
 {
     _data = StateMachine.CurrentData.Cast <TankData>();
 }
Example #23
0
 private void Start()
 {
     motor = gameObject.GetComponent <TankMotor>();
     data  = gameObject.GetComponent <TankData>();
 }
Example #24
0
 /// <summary>
 /// Clears the TankData component of this tank's current target (retains the transform
 /// and position of the target to allow this tank to investigate the last known position
 /// of the other tank).
 /// </summary>
 public void ClearTargetData()
 {
     targetTankData = null;
 }
    public override void OnInspectorGUI()
    {
        //DrawDefaultInspector();
        //return;

        TankData myTarget = (TankData)target;

        //mam własny edytor więc muszę w ten sposób zapisywać zmiany. Po wprowadzeniu zmian
        // należy zapisać cały projekt CTRL+S lub File/SaveProject
        EditorUtility.SetDirty(myTarget);

        DrawIcon(myTarget);

        myTarget.curretTab = GUILayout.Toolbar(myTarget.curretTab, new string[] { "Niszczyciel", "Zwykły" });

        GUILayout.Space(10);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Czołg:", EditorStyles.boldLabel);
        myTarget.tank = (DostempneCzolgi)EditorGUILayout.EnumPopup(myTarget.tank);
        EditorGUILayout.EndHorizontal();


        DrawDefaultTexture(myTarget);

        if (myTarget.curretTab == 0)    //Niszczyciel czołgów
        {
            myTarget.turretCan360 = false;

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Tekstura przykrycia wieży:");
            myTarget.czyPosiadamPrzykrycieLufy = EditorGUILayout.Toggle(myTarget.czyPosiadamPrzykrycieLufy);
            if (myTarget.czyPosiadamPrzykrycieLufy)
            {
                myTarget.turretCapTexture = (Sprite)EditorGUILayout.ObjectField(myTarget.turretCapTexture, typeof(Sprite), true);
            }
            else
            {
                myTarget.turretCapTexture = null;
            }
            if (myTarget.turretCapTexture == null)
            {
                myTarget.iHaveTurretCap = false;
            }
            else
            {
                myTarget.iHaveTurretCap = true;
            }
            EditorGUILayout.EndHorizontal();
        }
        else
        {
            myTarget.turretCan360 = true;
        }

        DrawDefaultParametrs(myTarget);

        DrawColliderSet(myTarget);

        DrawDefaultObjectPositon(myTarget);

        if (myTarget.curretTab == 0)    //Niszczyciel czołgów
        {
            myTarget.turretCapPos = EditorGUILayout.Vector2Field("przykrycie lufy:", myTarget.turretCapPos);
        }
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("*Należy postępować analogicznie do Collider aby ustawić te parametry", skin.GetStyle("tankDescription"));
        EditorGUILayout.EndHorizontal();

        GUILayout.Space(10);
        GUILayout.Label("Opis:", EditorStyles.boldLabel);
        myTarget.tempDescription = "<color=red>" + myTarget.name + "- </color>";
        GUILayout.Label(myTarget.tempDescription + "...");
        myTarget.description      = myTarget.tempDescription + myTarget.tempDescription2;
        myTarget.tempDescription2 = EditorGUILayout.TextField(myTarget.tempDescription2);
        GUILayout.Label("*Jest to opis głównie wykorzystywany w drzewku technoligii po najechaniu na czołg" +
                        ". Nie trzeba podawać nazwy czołgu specjalnie do tego opisu bo ona zostanie wygenerowana automatycznie" +
                        " więc... pisz od razu opis ;)", skin.GetStyle("tankDescription"));

        if (myTarget.tank == DostempneCzolgi.O_I)
        {
            myTarget.otherTurrets = new AutomaticTurret.TowerType[]
            {
                AutomaticTurret.TowerType.O_IButton,
                AutomaticTurret.TowerType.O_ITopLeft,
                AutomaticTurret.TowerType.O_ITopRight
            };
        }
        if (myTarget.tank == DostempneCzolgi.IS7)
        {
            myTarget.otherTurrets = new AutomaticTurret.TowerType[]
            {
                AutomaticTurret.TowerType.IS7OnHead
            };
        }
    }
Example #26
0
 /// <summary>
 /// Sets the target and all related information of this AI tank.
 /// </summary>
 /// <param name="newTarget">The Transform component of the tank's new target.</param>
 public void SetTarget(Transform newTarget)
 {
     currentTarget = newTarget;
     UpdateTargetPosition();
     targetTankData = newTarget.gameObject.GetComponent <TankData>();
 }
 // Use this for initialization
 void Start()
 {
     missileCD = GetComponent <Image>();
     data      = GetComponentInParent <TankData>();
 }
Example #28
0
 // Start is called before the first frame update
 void Start()
 {
     GameManager.Instance.Player = this.gameObject.transform;
     data  = GetComponent <TankData>();
     motor = GetComponent <TankMotor>();
 }
Example #29
0
 // Use Before Start
 private void Awake()
 {
     // tankdata is the data from each enemy tank component
     tankData = enemytank.gameObject.GetComponent <TankData>();
 }
Example #30
0
    // Start is called before the first frame update
    void Start()
    {
        data = GetComponent <TankData>();

        timeUntilNextEvent = timerDelay;
    }