コード例 #1
0
    public IEnumerator FreezePlayers(Collider2D _collider)
    {
        PhysicsController _otherPhys     = _collider.gameObject.GetComponent <PhysicsController>();
        SpellCharges      _otherCharge   = _collider.gameObject.GetComponent <SpellCharges>();
        Animator          _otherAnimator = _collider.gameObject.GetComponent <Animator>();

        _otherPhys.PausePhysics(true);
        _otherCharge.SetFreezeTimer(true);
        _otherAnimator.speed = 0.0f;

        SFXManager.PlayOneShot(m_reference.GetComponent <AudioSource>(), SFXManager.GetHitEffect());

        yield return(new WaitForSeconds(0.2f));

        _collider.gameObject.GetComponent <PlayerFSM>().SetCurrentState(PlayerFSM.States.HIT, true);

        _otherPhys.ClearValues();
        _otherPhys.PausePhysics(false);
        _otherCharge.SetFreezeTimer(false);
        _otherAnimator.speed = 1.0f;



        ApplyForce(_collider);

        DestroyObject();
    }
コード例 #2
0
 public Spell(Unit caster, float range, int manaCost, int charges, float cooldown)
 {
     this.manaCost    = manaCost;
     this.cooldown    = cooldown;
     this.chargesLeft = charges;
     this.caster      = caster;
     this.range       = range;
 }
コード例 #3
0
 void Start()
 {
     m_actorProperties         = new Properties();
     m_movementController      = GetComponent(typeof(MovementController))          as MovementController;
     m_physicsController       = GetComponent(typeof(PhysicsController))           as PhysicsController;
     m_boxCollider             = GetComponent(typeof(BoxCollider2D))               as BoxCollider2D;
     m_inputHandler            = GetComponent(typeof(InputHandler))                as InputHandler;
     m_spellCharges            = GetComponent(typeof(SpellCharges))                as SpellCharges;
     m_componentAnimator       = GetComponent(typeof(Animator))                    as Animator;
     m_grimoire                = GetComponent(typeof(Grimoire))                    as Grimoire;
     m_particleManager         = GetComponentInChildren(typeof(ParticleManager))   as ParticleManager;
     m_renderer                = GetComponentInChildren(typeof(Renderer))          as Renderer;
     m_renderer.material.color = actorColor;
     m_invulnerable            = false;
 }
コード例 #4
0
    /// <summary>
    /// Freeze the players for a set amount of time in their animator before resuming it. This is going to contribute to the
    /// feeling of force applied by an attack.
    /// </summary>
    /// <param name="_collider"></param>
    /// <returns></returns>
    public IEnumerator FreezePlayers(Collider2D _collider)
    {
        PhysicsController _thisPhys     = transform.parent.gameObject.GetComponent <PhysicsController>();
        SpellCharges      _thisCharge   = transform.parent.gameObject.GetComponent <SpellCharges>();
        Animator          _thisAnimator = transform.parent.gameObject.GetComponent <Animator>();

        PhysicsController _otherPhys     = _collider.gameObject.GetComponent <PhysicsController>();
        SpellCharges      _otherCharge   = _collider.gameObject.GetComponent <SpellCharges>();
        Animator          _otherAnimator = _collider.gameObject.GetComponent <Animator>();

        _thisPhys.PausePhysics(true);
        _otherPhys.PausePhysics(true);

        _thisCharge.SetFreezeTimer(true);
        _otherCharge.SetFreezeTimer(true);

        _thisAnimator.speed  = 0.0f;
        _otherAnimator.speed = 0.0f;

        //Instantiate Particle Systems
        Vector3 offSet = new Vector3(0.0f, 1.0f, 0.0f);

        Instantiate(particleOnHit, _collider.transform.localPosition + offSet, Quaternion.identity);

        yield return(new WaitForSeconds(m_onHitFreezeDuration));

        _collider.gameObject.GetComponent <PlayerFSM>().SetCurrentState(PlayerFSM.States.HIT, true);

        _thisPhys.PausePhysics(false);
        _otherPhys.PausePhysics(false);

        _thisCharge.SetFreezeTimer(false);
        _otherCharge.SetFreezeTimer(false);

        _thisAnimator.speed  = 1.0f;
        _otherAnimator.speed = 1.0f;



        ApplyForce(_collider, true);
    }
コード例 #5
0
    //public void Init()
    //{
    //    Start();
    //}

    public void Init()
    {
        m_SelectedPage = null;
        m_spellCharges = GetComponent <SpellCharges>();

        if (grimoirePages.Length > 0)
        {
            m_PageAmount    = grimoirePages.Length;
            m_internalPages = new Page[m_PageAmount];

            for (int i = 0; i < m_PageAmount; i++)
            {
                //grimoirePages[i].enabled = false;
                m_internalPages[i] = Instantiate(grimoirePages[i], this.gameObject.transform.position, Quaternion.identity) as Page;
                m_internalPages[i].transform.parent = this.gameObject.transform;
                m_internalPages[i].parent           = this.gameObject;
            }
            PostStart();
            m_SelectedPage = m_internalPages[0];
            m_pageIndex    = 1;
        }
    }
コード例 #6
0
 public override void Start()
 {
     m_spellChargeReference = transform.parent.gameObject.GetComponent <SpellCharges>();
     base.Start();
 }
コード例 #7
0
 /// <summary>
 /// Set the number of charges the spell can use.
 /// </summary>
 /// <param name="charges">the number of charges.</param>
 public void SetCharges(SpellCharges charges)
 {
     this.chargesLeft = charges;
 }