Example #1
0
 void Destroy()
 {
     if (PrefabBank.instance == this)
     {
         PrefabBank.instance = null;
     }
 }
Example #2
0
 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());
 }
Example #3
0
    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);
        }
    }
Example #4
0
    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;
    }
Example #5
0
    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;
    }
Example #6
0
    // 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);
        }
    }
Example #7
0
 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>();
 }
Example #9
0
 public void setPrefabBank(PrefabBank val)
 {
     prefabBank = val;
 }
Example #10
0
 void Awake()
 {
     _prefabBank = this;
     DontDestroyOnLoad(this.gameObject);
 }
Example #11
0
 // Use this for initialization
 void Start()
 {
     prefabBank         = GetComponent <PrefabBank>();
     timeSinceLastRaven = -firstRavenDelay;
 }
Example #12
0
 void Start()
 {
     player       = GameObject.Find("Player");
     prefabBank   = GameObject.Find("_PrefabBank").GetComponent <PrefabBank>();
     playerOffset = transform.position - player.transform.position;
 }
Example #13
0
 private void Awake()
 {
     ME = this;
     DontDestroyOnLoad(this.gameObject);
 }