Inheritance: MonoBehaviour
Beispiel #1
0
    protected override void Awake()
    {
        id = Lists.Spell.Swordboomerang;

        base.Awake();

        swordBoomerang = new ObjectRecycler();
        swordBoomerang.CreatePool(ObjectName.skillHolder, "Fawkes-SwordBoomerang", spellPrefab[0], 3);
        swordBoomerangBehaviour = new SwordBoomerangProjectile[swordBoomerang.all.Count];
        for (int i = 0; i < swordBoomerang.all.Count; i++)
        {
            swordBoomerangBehaviour[i]                = swordBoomerang.all[i].GetComponent <SwordBoomerangProjectile>();
            swordBoomerangBehaviour[i].Damage         = damage;    // * (1 + PlayerStats.damageModifier) * (1 + (PlayerStats.playerLevel * 0.1f));
            swordBoomerangBehaviour[i].Range          = range;
            swordBoomerangBehaviour[i].Radius         = radius;
            swordBoomerangBehaviour[i].Speed          = speed;
            swordBoomerangBehaviour[i].StatusDuration = 5;
            swordBoomerangBehaviour[i].ApplyStatus    = Lists.Status.Slowed;
        }
        nSender = new NetworkTransformSender[swordBoomerang.all.Count];
        for (int i = 0; i < swordBoomerang.all.Count; i++)
        {
            nSender[i] = swordBoomerang.all[i].GetComponent <NetworkTransformSender>();
        }
    }
Beispiel #2
0
    private void Awake()
    {
        if (!Singleton)
        {
            Singleton = this;
            //TEMP: Reload the scene will have issue
            //DontDestroyOnLoad(gameObject);

            recycledObjects = new Stack <Recyclable> [prefabs.Length];

            GameObject child;
            for (int id = 0; id < recycledObjects.Length; id++)
            {
                recycledObjects[id] = new Stack <Recyclable>(256);

                child = new GameObject(id.ToString() + " - " + prefabs[id].name);
                child.transform.parent        = transform;
                child.transform.localPosition = Vector3.zero;
            }
        }
        else if (this != Singleton)
        {
            Destroy(gameObject);
        }
    }
 public void OnSpawn(ObjectRecycler recycler, GameObject prefab)
 {
     Recycler = recycler;
     Original = prefab;
     if (Spawned != null) {
         Spawned(this);
     }
 }
Beispiel #4
0
    protected override void Awake()
    {
        id = Lists.Spell.Lifesteal;

        base.Awake();

        lsParticles = new ObjectRecycler();
        lsParticles.CreatePool(ObjectName.skillHolder, "Fawkes-Lifesteal-Particles", spellPrefab[0], 3);
    }
Beispiel #5
0
    void Start()
    {
        // create an object recycler to manage our bullets
        recycler = new ObjectRecycler(bulletPrefab, 3);

        recycler.onObjectRecylerChanged += delegate(int available, int total)
        {
            headUpText.text = string.Format("Available bullets: {0}\r\nTotal bullets: {1}", available, total);
        };
    }
    void Start()
    {
        // create an object recycler to manage our bullets
        recycler = new ObjectRecycler( bulletPrefab, 3 );

        recycler.onObjectRecylerChanged += delegate( int available, int total )
        {
            headUpText.text = string.Format( "Available bullets: {0}\r\nTotal bullets: {1}", available, total );
        };
    }
 public override void Init()
 {
     base.Init();
     this.mGrid           = this.transform.FindChild("ParentRoot/Grid").GetComponent <UIGrid>();
     this.mEnemyCache     = this.transform.FindChild("EnemyCache").gameObject;
     this.mFriendListen   = TriggerManager.CreateGameEventTrigger(GameEvent.GameStart, null, new TriggerAction(this.ShowFriendsInfo));
     this._playerInfoPool = new ObjectRecycler <PlayersInfoItem>(new Func <PlayersInfoItem>(this.CreatePlayerInfo), delegate(PlayersInfoItem x)
     {
         UnityEngine.Object.Destroy(x.gameObject);
     });
 }
    //Gets a Recycler. If there isn't one, make it!
    private ObjectRecycler GetRecycler(int recyclerID, GameObject goToMake)
    {
        if (this.recyclerDictionary.ContainsKey(recyclerID))
        {
            return(this.recyclerDictionary[recyclerID]);
        }
        else
        {
            ObjectRecycler newOR = new ObjectRecycler(goToMake, 0);

            this.recyclerDictionary.Add(recyclerID, newOR);

            return(newOR);
        }
    }
    private GameObject GetNextFreeObject(GameObject objectToGet)
    {
        if (!IsRecycleable(objectToGet))//Make sure it has an ID
        {
            this.MakeObjectRecycleable(objectToGet);
        }

        int id = this.GetRecyclerID(objectToGet);              //Get the ID so we can get the corresponding Recycler

        ObjectRecycler oR = this.GetRecycler(id, objectToGet); //Get the Recycler, send GO incase we need to make a new one

        GameObject tempGO = oR.NextFreeObject;

        this.AttachRecyclableObjectScript(tempGO, id);

        return(tempGO);//Return nextFree!
    }
    private void Awake()
    {
        myTransform = transform;
        nSender     = GetComponent <NetworkTransformSender>();

        //trailRenderers = gameObject.GetComponentsInChildren<NewTimedTrailRenderer>();
        for (byte i = 0; i < trailRenderers.Length; i++)
        {
            trailRenderers[i].emit = false;
        }

        damageDealer = new ObjectRecycler();
        damageDealer.CreatePool(ObjectName.skillHolder, "Fawkes-SwordBoomerang-DamageDealer", damageDealerPrefab, 5);
        damageDealerBehaviour = new DamageDealer[damageDealer.all.Count];
        for (int i = 0; i < damageDealer.all.Count; i++)
        {
            damageDealerBehaviour[i] = damageDealer.all[i].GetComponent <DamageDealer>();
        }
    }
Beispiel #11
0
    private void Awake()
    {
        instance = this;

        comboEffects = new ObjectRecycler();
        comboEffects.CreatePool(ObjectName.comboHolder, "Combo-Effects", comboEffectPrefab, 20);
        //comboEffectsPlaceholder = GameObject.Find("Combo-Effects-Holder").transform;
        for (byte i = 0; i < comboEffects.all.Count; i++)
        {
            comboEffects.all[i].transform.parent        = comboEffectsPlaceholder;
            comboEffects.all[i].transform.localPosition = Vector3.zero;
        }

        //comboLabelGO = GameObject.Find("Combo-Label");
        comboLabel         = comboLabelGO.GetComponent <UILabel>();
        comboLabelTrans    = comboLabel.transform;
        comboLabelPos      = comboLabelTrans.position;
        comboLabelIniScale = comboLabelTrans.localScale;
        comboHolder.SetActive(false);
    }
    protected override void Awake()
    {
        id      = Lists.Spell.Whirlwindstrike;
        ccMover = GetComponent <CCMover>();

        base.Awake();

        trails = GetComponentsInChildren <NewTimedTrailRenderer>();
        for (int i = 0; i < trails.Length; i++)
        {
            trails[i].emit = false;
        }

        damageDealer = new ObjectRecycler();
        damageDealer.CreatePool(ObjectName.skillHolder, "Fawkes-WhirlwindStrike", skillHandler.DamageCollider, 5);
        damageDealerBehaviour = new DamageDealer[damageDealer.all.Count];
        for (int i = 0; i < damageDealer.all.Count; i++)
        {
            damageDealerBehaviour[i]        = damageDealer.all[i].GetComponent <DamageDealer>();
            damageDealerBehaviour[i].Damage = damage;            // * (1 + PlayerStats.damageModifier) * (1 + (PlayerStats.playerLevel * 0.1f));
            damageDealerBehaviour[i].gameObject.transform.localScale = new Vector3(radius, radius, radius);
        }
    }
Beispiel #13
0
    protected override void Awake()
    {
        id = Lists.Spell.Slash;

        base.Awake();

        trails = GetComponentsInChildren <NewTimedTrailRenderer>();
        for (int i = 0; i < trails.Length; i++)
        {
            trails[i].emit = false;
        }

        damageDealer = new ObjectRecycler();
        damageDealer.CreatePool(ObjectName.skillHolder, "Fawkes-Slash", skillHandler.DamageCollider, 3);
        damageDealerBehaviour = new DamageDealer[damageDealer.all.Count];
        for (int i = 0; i < damageDealer.all.Count; i++)
        {
            damageDealerBehaviour[i]        = damageDealer.all[i].GetComponent <DamageDealer>();
            damageDealerBehaviour[i].Damage = damage * (1 + (i * 0.2f));            // * (1 + PlayerStats.damageModifier) * (1 + (PlayerStats.playerLevel * 0.1f));
            damageDealerBehaviour[i].gameObject.transform.localScale = new Vector3(radius, radius, radius);
        }

        //audioSources = SoundManager.AttachAudioSources(audioClip, skillHandler.MyTransform, 3);
    }
 public void Create()
 {
     _recycler = new ObjectRecycler( prefab.gameObject, poolSize, parent );
 }
Beispiel #15
0
    void Awake()
    {
        // get references
        myCharacter = GetComponent<Character>();
        myTransform = transform;
        myMagic = GetComponent<Magic>();

        // setup
        if (!melee)
        {
            Attack_Pool = new ObjectRecycler(Attack_Prefab, (projectile ? null : myTransform));
        }
    }
Beispiel #16
0
	// Use this for initialization
	void OnEnable () {
        render = GetComponent<SpriteRenderer>();
        recycler = GetComponent<ObjectRecycler>();
        render.color = Color.white;
        StartCoroutine(FadeCurrentData());
	}	
 public void OnEnable()
 {
     _recycler = (ObjectRecycler)target;
 }