Hello everyone
I and a friend are creating a mini-moba, but we have a problem in the script for towers
basically I would like that when a player or a bot comes within range of the tower, it has to read from the script “info” (awarded to the player and bot) belongs to which team the player or the bot, and in case an enemy and points to him.
I created this script helping with the documentation of unity, but I can not solve this problem:
Assets/script/game/torretteB.cs(22,49): error CS1061: Type `UnityEngine.Component' does not contain a definition for `Team' and no extension method `Team' of type `UnityEngine.Component' could be found (are you missing a using directive or an assembly reference?)
this are the script:
using UnityEngine;
using System.Collections;
public class torretteB : MonoBehaviour {
public int teamID; //0 red team -- 1 Blueteam
public int teamobject;
private Vector3 targetpoint = Vector3.zero;
GameObject kObject;
// Use this for initialization
void Start () {
teamID=1;// blueteam
}
void OnTriggerEnter(Collider collider)
{
kObject=collider.gameObject;
if(kObject.GetComponent("info").Team != teamID)
{
targetpoint = kObject.gameObject.transform.position;
Quaternion rotation = Quaternion.LookRotation (targetpoint - transform.position);
transform.rotation = rotation;
}
}
}
sorry for my english, I am italian