void Destroy() { if (PrefabBank.instance == this) { PrefabBank.instance = null; } }
void Start() { audioBank = GameObject.Find("_AudioBank").GetComponent <AudioBank>(); prefabBank = GameObject.Find("_PrefabBank").GetComponent <PrefabBank>(); player = GameObject.FindGameObjectWithTag("Player"); enemy = GetComponent <Enemy>(); rb = GetComponent <Rigidbody>(); StartCoroutine(BeginFiring()); }
void instantiateAvatar(GameData.TEAM team, GameData.TYPE hero) { Debug.Log("INSTA " + team + " , " + hero); Avatar avt = null; EntityMotorActions actions = null; avt = PrefabBank.GET_AVATAR(hero); actions = EntityMotorActionBank.GET(hero); if (avt == null) { return; } m_entityMotor.resetState(); if (m_avatar != null) { GameObject.Destroy(m_avatar.gameObject); } if (m_entityMotorActions != null) { m_entityMotorActions.unLink(this.m_entityMotor); GameObject.Destroy(m_entityMotorActions.gameObject); m_entityMotorActions = null; } Avatar me = GameObject.Instantiate <Avatar>(avt); me.transform.parent = this.transform; me.transform.localPosition = Vector3.zero; me.transform.localRotation = Quaternion.identity; //Debug.Log(team); if (team == GameData.TEAM.RED) { me.setMaterial(BANK_PREFAB.MAT_TEAM_RED); } else if (team == GameData.TEAM.BLUE) { me.setMaterial(BANK_PREFAB.MAT_TEAM_BLUE); } if (me.m_head == null) { m_netTransformChildHead.enabled = false; } else { m_netTransformChildHead.enabled = true; m_netTransformChildHead.target = me.m_head.transform; } m_avatar = me; if (actions != null) { m_entityMotorActions = GameObject.Instantiate <EntityMotorActions>(actions); m_entityMotorActions.link(m_entityMotor); } }
public void RpcLoadPrefab_INDEPENDENT(PREFAB_ID id, GameData.TEAM team) { var t = PrefabBank.SPAWN(id, team); if (t == null) { return; } //t.transform.parent = this.transform; t.transform.position = this.transform.position; t.transform.rotation = this.transform.rotation; }
public void RpcLoadPrefab_Separate(PREFAB_ID id, GameData.TEAM team, Vector3 pos, Vector3 dirLook) { var t = PrefabBank.SPAWN(id, team); if (t == null) { return; } //t.transform.parent = this.transform; t.transform.position = pos; t.transform.LookAt(pos + dirLook); //t.transform.rotation = this.transform.rotation; }
// Use this for initialization void Start() { prefabBank = GetComponent <PrefabBank>(); roots = GetComponent <Roots>(); foliage = GetComponent <Foliage>(); int len = spawningObjects.Count; for (int i = 0; i < len; i++) { spawningVectors.Add(spawningObjects[i].transform.position); slots.Add(true); spawningObjects[i].SetActive(false); } }
void Awake() { PrefabBank.instance = this; }
void Start() { prefabBank = GameObject.Find("_PrefabBank").GetComponent <PrefabBank>(); audioBank = GameObject.Find("_AudioBank").GetComponent <AudioBank>(); playerRB = GameObject.Find("Player").GetComponent <Rigidbody>(); }
public void setPrefabBank(PrefabBank val) { prefabBank = val; }
void Awake() { _prefabBank = this; DontDestroyOnLoad(this.gameObject); }
// Use this for initialization void Start() { prefabBank = GetComponent <PrefabBank>(); timeSinceLastRaven = -firstRavenDelay; }
void Start() { player = GameObject.Find("Player"); prefabBank = GameObject.Find("_PrefabBank").GetComponent <PrefabBank>(); playerOffset = transform.position - player.transform.position; }
private void Awake() { ME = this; DontDestroyOnLoad(this.gameObject); }