// Update is called once per frame
	//void Update () {
	//	update_timers ();
	//}

	void Start() {
		//Unity stuff
		fac = Types.Faction.RED;//TODO test only
		rb = GetComponent<Rigidbody> ();

		//init stats
		flags.init ();
		c_flags.init ();
		base_u_stats.init ();
		base_c_stats.init ();
		runtime_c_stats.init ();
		runtime_c_stats.level = 10;

		load_garen_base_stats ();
		//init runtime stats
		runtime_u_stats = base_u_stats;

		//set timers
		autoAtkTimer = new Utility.Timer(runtime_u_stats.attack_speed);
		Q_timer = new Utility.Timer (0f);
		W_timer = new Utility.Timer (0f);
		E_timer = new Utility.Timer (0f);
		R_timer = new Utility.Timer (0f);
		Passive_timer = new Utility.Timer (0f);
		status = new List<Status> ();
		//rb.detectCollisions = true;
		//init appearances
		//load special FX
	}
Exemple #2
0
 //Virtuals
 public override void init()
 {
     ui            = Utility.get_UI(transform.parent.gameObject);
     ui_champ      = Utility.get_UI(transform.parent.gameObject) as UI_Champion;
     fac           = Types.Faction.OTHER;
     autoAtkTimer  = new Utility.Timer(1f);
     Q_timer       = new Utility.Timer(0f);
     W_timer       = new Utility.Timer(0f);
     E_timer       = new Utility.Timer(0f);
     R_timer       = new Utility.Timer(0f);
     Passive_timer = new Utility.Timer(0f);
     death_timer   = new Utility.Timer(0f);
     //not using this for now
     ai_takeover_timer = new Utility.Timer(GameSceneConsts.ai_takeover_time);
     status            = new List <Status> ();
     self_col          = GetComponent <Collider> ();
     init_AtkTarget();
     init_resources();
     //navagent = transform.parent.FindChild("NavUnit").gameObject.GetComponent<NavMeshAgent>();
     //navagent.transform.SetParent (null);
     //navagent.gameObject.AddComponent (Network);
     //navagent.updateRotation = false;
     //navagent.updatePosition = false;
     rotation_override = false;
 }
Exemple #3
0
    public void init(Unit _host, Collider _self, PotentialTarget _tgt = PotentialTarget.ANY, Decision _dec = Decision.IDEL)
    {
        ThinkTimer = new Utility.Timer(thinkPeriod);
        ThinkTimer.start_timer();
        self          = _self;
        unit          = _host;
        _host.AI_unit = this;
        target        = _tgt;
        decision      = _dec;
        vision        = GetComponent <CapsuleCollider> ();

        objWithin_Ally_champ     = new List <GameObject>();
        objWithin_Ally_minion    = new List <GameObject>();
        objWithin_Ally_struct    = new List <GameObject>();
        objWithin_Ally_item      = new List <GameObject>();
        objWithin_Hostile_champ  = new List <GameObject>();
        objWithin_Hostile_minion = new List <GameObject>();
        objWithin_Hostile_struct = new List <GameObject>();
        objWithin_Hostile_item   = new List <GameObject>();
        objWithin_neturals       = new List <GameObject> ();
        listedby          = new List <GameObject> ();
        temp_untargetable = new List <GameObject> ();

        init_special();
    }
Exemple #4
0
    public override void init()
    {
        init_pre();
        ui       = Utility.get_UI(transform.parent.gameObject);
        ui_champ = Utility.get_UI(transform.parent.gameObject) as UI_Champion;
        rb       = GetComponent <Rigidbody> ();

        if (!netID.isLocalPlayer && isPlayer)
        {
            return;
        }

        death_timer = new Utility.Timer(0f);
        death_timer.change_max_timer(2f);         //TODO should not be a fixed value;
        death_timer.reset_timer();

        //if (transform.parent.FindChild ("NavUnit") != null) {
        //	navagent = transform.parent.FindChild ("NavUnit").gameObject.GetComponent<NavMeshAgent> ();
        //	if (navagent != null)
        //		navagent.transform.SetParent (null);
        //}
        //navagent.updateRotation = false;
        //navagent.updatePosition = false;

        //init stats
        flags.init();
        c_flags.init();
        base_u_stats.init();
        bonus_u_stats.init();
        u_stats_growth.init();
        base_c_stats.init();
        runtime_c_stats.init();
        status = new List <Status> ();

        load_garen_base_stats();
        init_garen_skills();
        init_post();

        /*
         *      //init runtime stats
         *      runtime_u_stats = base_u_stats;
         *      update_attack_speed ();
         *      update_movement_speed ();
         *
         *      //set suto attack timers
         *      autoAtkTimer = new Utility.Timer(runtime_u_stats.attack_speed);
         *      autoAtkTimer.start_timer ();
         *      //rb.detectCollisions = true;
         *      //init appearances
         *      //load special FX
         *
         *      //Unity stuff
         *      self_col = GetComponent<Collider> ();
         *      init_AtkTarget ();
         *
         *      init_resources ();
         */
        //navagent.updatePosition = false;
    }
 public void init_post_tower()
 {
     runtime_u_stats = base_u_stats;
     update_attack_speed();
     autoAtkTimer = new Utility.Timer(runtime_u_stats.attack_speed);
     autoAtkTimer.start_timer();
     init_AtkTarget();
     init_resources();
 }
Exemple #6
0
    void init_garen_skills()
    {
        Q_skill = new skill();
        Q_skill.need_indicate_target = false;
        W_skill = new skill();
        W_skill.need_indicate_target = false;
        W_skill.cd = 24f;
        E_skill    = new skill();
        E_skill.need_indicate_target = false;
        R_skill = new skill();
        R_skill.need_indicate_target = true;
        Passive_skill = new skill();

        Q_timer = new Utility.Timer(Q_cd);
        Q_timer.finish();
        W_timer = new Utility.Timer(W_skill.cd);
        W_timer.finish();
        E_timer = new Utility.Timer(E_cd);
        E_timer.finish();
        R_timer = new Utility.Timer(R_skill.cd);
        R_timer.finish();
        Passive_timer = new Utility.Timer(Passive_skill.cd);

        Q_flag       = false;
        W_flag       = false;
        E_flag       = false;
        Passive_flag = false;

        //Q : Decisive Strike
        Q_skill.cd       = 8f;
        Q_skill.dmg      = 30f;
        Q_skill.ad_ratio = 1.4f;
        Q_skill.timer.change_max_timer(Q_skill.cd);
        Q_dur_timer      = new Utility.Timer(4.5f);    //its fixed
        Q_move_dur_timer = new Utility.Timer(Q_move_time);
        Q_silence_time   = 1.5f;
        //TODO test only
        Q_skill.level = 4;
        upgrade_skill("Q");

        //W :
        W_dur_timer = new Utility.Timer(W_dur);

        //E : Judgement
        E_dur_timer  = new Utility.Timer(E_dur);
        E_aoe_prefab = Resources.Load("Prefabs/Champions/Garen/Garen_E_prefab") as GameObject;
        E_damage     = new Types.damage_combo();
        //TODO test only
        E_skill.level = 0;
        upgrade_skill("E");
        W_skill.level = 0;
        upgrade_skill("W");

        //TODO test only
        R_skill.level = 2;
        upgrade_skill("R");
    }
Exemple #7
0
 public override void init()
 {
     init_pre();
     ui           = Utility.get_UI(transform.parent.gameObject);
     struct_timer = new Utility.Timer(1f);
     load_structure_stats();
     runtime_u_stats = base_u_stats;
     init_AtkTarget();
     init_resources();
 }
 public void init(float time)
 {
     depend_on_pos = false;
     isnot_default = true;
     name          = "default status name";
     flags         = "";
     dur           = time;
     timer         = new Utility.Timer(dur);
     timer.start_timer();
 }
    public void init(Collider slf, float radius, bool continuous,
                     Types.damage_combo dmg, Types.damage_combo start_dmg, Types.damage_combo end_dmg,
                     float dur = 0, int times_of_dmg = 0, //paras for continuous damage
                     bool crit = false,
                     float single_tgt_bonus  = 0,         //if only one target in there, any additional damage?
                     bool champ              = true, bool minion = true, bool neturals = true,
                     Utility.Timer share_dur = null, Utility.Timer share_dmg   = null,
                     Status enter_sts        = default(Status), Status end_sts = default(Status))
    {
        self                = slf;
        duration            = dur;
        damage              = dmg;
        start_damage        = start_dmg;
        end_damage          = end_dmg;
        max_damage_times    = times_of_dmg;
        done_damage_times   = 0;
        can_crit            = crit;
        single_target_bonus = single_tgt_bonus;
        enter_status        = enter_sts;
        end_status          = end_sts;

        affect_champions = champ;
        affect_minions   = minion;
        affect_neturals  = neturals;
        is_continuous    = continuous;
        if (is_continuous)
        {
            if (share_dur == null)
            {
                sharing_dur = false;
                dur_timer   = new Utility.Timer(dur);
                dur_timer.start_timer();
            }
            else
            {
                sharing_dur = true;
                dur_timer   = share_dur;
            }

            if (share_dmg == null)
            {
                sharing_dmg = false;
                dmg_timer   = new Utility.Timer((float)(duration / max_damage_times));
                dmg_timer.start_timer();
            }
            else
            {
                sharing_dmg = true;
                dmg_timer   = share_dmg;
            }
        }

        clder        = GetComponent <CapsuleCollider> ();
        clder.radius = radius * GameSceneConsts.dist_multiplier;
    }
    public bool need_indicate_target;    //true for skill shot, targted skills, and targeted aoes

    public skill()
    {
        type                 = Type.NORMAL;
        cost                 = 0;
        cd                   = 0;
        dmg                  = 0;
        ad_ratio             = 0;
        ap_ratio             = 0;
        level                = 0;
        timer                = new Utility.Timer(0f);
        need_indicate_target = false;
    }
 public void init_post()
 {
     runtime_u_stats = base_u_stats;
     update_attack_speed();
     //update_movement_speed ();//called from outside
     autoAtkTimer = new Utility.Timer(runtime_u_stats.attack_speed);
     autoAtkTimer.start_timer();
     init_AtkTarget();
     init_resources();
     //netUnit = transform.parent.GetComponent<NetworkUnit>();
     //netUnit.init(runtime_u_stats.max_hp, runtime_u_stats.max_mana);
 }
 // Use this for initialization
 public void init(Garen _host, Utility.Timer E_timer, int damageTime, Types.damage_combo _dmg)
 {
     targets         = new List <Unit> ();
     host            = _host;
     self_col        = GetComponent <CapsuleCollider> ();
     self_col.radius = 325f * GameSceneConsts.dist_multiplier;
     dur_timer       = E_timer;
     dmg             = _dmg;
     //how many times E deals damage
     dmgTimeRemaining = damageTime;
     maxDmgTime       = damageTime;
     //it become damage per time
     dmg.physical_dmg /= (float)damageTime;
     timeStep          = 3f * 100f / (float)damageTime;
 }
Exemple #13
0
    void init(Types.Lanes _lane = Types.Lanes.OTHER, Types.Faction _fac = Types.Faction.OTHER)
    {
        //fac = _fac;
        //lane = _lane;
        type = WaveType.NORMAL;

        wave_active = false;
        timer_wave  = new Utility.Timer(GameSceneConsts.minion_wave_interval);
        timer_wave.finish();
        timer_micro = new Utility.Timer(GameSceneConsts.minion_spawn_interval);
        timer_wave.start_timer();
        timer_micro.start_timer();
        //load Resources
        minion_prefab = Resources.Load("Prefabs/Minions/minion_test") as GameObject;
    }
Exemple #14
0
        /// <summary>
        /// Run the game and begin the main loop.
        /// </summary>
        /// <param name="startScreen">The screen to show on startup.</param>
        public void Run(string startScreen)
        {
            float delta = 0.0f;

            Startup();

            running = true;
            timer   = new  FallenGE.Utility.Timer();
            if (startScreen != "")
            {
                ChangeScreen(startScreen);
            }

            while (running == true)
            {
                timer.Start();

                running = Core.Update();
                engine.KeyboardManager.Capture();
                engine.GamepadManager.Capture();

                Render();
                Update(delta);

                timer.Stop();

                delta = timer.Delta;
                if (pause)
                {
                    delta = 0;
                }
            }

            if (currentScreen != null)
            {
                currentScreen.TransOut();
                currentScreen.Unload();
            }
            Shutdown();
        }
    //call this before actual init();
    public void init_pre()
    {
        netID          = transform.parent.gameObject.GetComponent <NetworkIdentity> ();
        self_col       = GetComponent <Collider> ();
        cur_target_obj = null;
        status         = new List <Status> ();
        flags          = new unit_flags();
        flags.init();

        if ((!netID.isLocalPlayer) && (isPlayer))
        {
            return;
        }

        //stats
        base_u_stats = new unit_stats();
        base_u_stats.init();
        base_u_stats_mult = new unit_stats();
        base_u_stats_mult.init_to_1();
        u_stats_growth = new unit_stats();
        u_stats_growth.init();
        bonus_u_stats = new unit_stats();
        bonus_u_stats.init();
        bonus_u_stats_mult = new unit_stats();
        bonus_u_stats_mult.init_to_1();

        inCombat_timer = new Utility.Timer(GameSceneConsts.in_combat_time);
        regen_timer    = new Utility.Timer(GameSceneConsts.regen_interval);
        regen_timer.start_timer();
        items = new Item[GameSceneConsts.max_item + GameSceneConsts.max_supp_item];
        for (int i = 0; i < items.Length; ++i)
        {
            items [i] = null;
        }
        Onhit_dmg = new Types.damage_combo();
        Onhit_dmg.init();
        recent_dmg_receive = new Types.damage_combo();
        recent_dmg_receive.init();
    }
 /// <summary>
 /// Remove the timer from being ticked by the tree.
 /// </summary>
 public void RemoveTimer(Utility.Timer timer)
 {
     activeTimers.Remove(timer);
 }
 /// <summary>
 /// Add the timer so it gets ticked whenever the tree ticks.
 /// </summary>
 public void AddTimer(Utility.Timer timer)
 {
     activeTimers.Add(timer);
 }
Exemple #18
0
 // Use this for initialization
 void Start()
 {
     spawnTimer = new Utility.Timer(BollOutTime);
     spawnTimer.OnTimeUpFunc = SpawnBall;
     spawnTimer.Start();
 }