Exemple #1
0
    public void Magic(bool boost, float mig, Ability a, int power, Vector3 user, string attackerName, Vector3 vector, int element)//使用者から発射される系
    {
        int id = a.Id;

        id -= StartMagicNumber;
        GameObject  m  = (GameObject)Instantiate(Resources.Load(magic + id.ToString()), user, Quaternion.LookRotation((vector - user).normalized));
        MagicScript ma = m.GetComponent <MagicScript>();

        ma.attackerName = attackerName;
        ma.CharaPower   = power;
        ma.MagicPower   = a.Attack;
        if (element != -1)
        {
            ma.Element = element;
        }
        else
        {
            ma.Element = (int)a.element;
        }
        if (boost)
        {
            ma.elementPower = a.value * mig;
        }
        else
        {
            ma.elementPower = a.value;
        }
    }
Exemple #2
0
    public void Magic(bool boost, float mig, Ability a, int power, Vector3 target, string attackerName, int element)//指定位置に発生する系
    {
        int id = a.Id;

        id -= StartMagicNumber;
        GameObject  m  = (GameObject)Instantiate(Resources.Load(magic + id.ToString()), target, Quaternion.identity);
        MagicScript ma = m.GetComponent <MagicScript>();

        ma.attackerName = attackerName;
        ma.CharaPower   = power;
        ma.MagicPower   = a.Attack;
        if (element != -1)
        {
            ma.Element = element;
        }
        else
        {
            ma.Element = (int)a.element;
        }
        if (boost)
        {
            ma.elementPower = a.value * mig;
        }
        else
        {
            ma.elementPower = a.value;
        }
    }
 public void Awake()
 {
     if (instance != null)
     {
         Debug.LogWarning("More than one instance of Inventory found!");
         return;
     }
     instance = this;
 }
Exemple #4
0
 // Start is called before the first frame update
 void Awake()
 {
     mS = this;
     leftHandParticle  = leftHand.GetComponent <ParticleSystem>().main;
     rightHandParticle = rightHand.GetComponent <ParticleSystem>().main;
     anim      = GetComponent <Animator>();
     currSpell = baseAtk;
     canShoot  = true;
 }
Exemple #5
0
 public override void SelfSpellInitialization()
 {
     GetComponent <TimedDestroyer>().enabled = false;
     transform.localScale *= 2f / 3f;
     if (MagicScript != null)
     {
         MagicScript.AddSpellToUpdateList(this);
     }
     GetComponent <Collider>().enabled = false;
 }
Exemple #6
0
 public override void SelfSpellInitialization()
 {
     GetComponent <TimedDestroyer>().enabled = false;
     GetComponent <SphereCollider>().enabled = false;
     if (MagicScript != null)
     {
         MagicScript.AddSpellToUpdateList(this);
     }
     Ray.SetPosition(0, transform.position);
     Ray.SetPosition(1, transform.position + transform.forward);
 }
Exemple #7
0
        public override void MagicUpdate(Vector3 screenCoords)
        {
            Rigidbody body = MagicScript.GetComponent <Rigidbody>();

            if (body != null)
            {
                body.AddForce(-Physics.gravity * 1.9f);
            }
            MagicScript.AddOverload(SpellIndex, SelfSpellOverloadPerSecond * Time.deltaTime);

            if (MagicScript.SpellOverloads[SpellIndex] > OverloadThreshold)
            {
                PhotonNetwork.Destroy(gameObject);
            }
        }
Exemple #8
0
        public override void MagicUpdate(Vector3 screenCoords)
        {
            Tuple <Vector3, Quaternion> newPos;

            if (IsSelfSpell)
            {
                newPos = GetSelfInstantiationPosition(MagicScript, screenCoords);

                if (newPos == null)
                {
                    PhotonNetwork.Destroy(gameObject);
                    return;
                }
                transform.position = Vector3.Lerp(transform.position, newPos.First, LerpSpeed);
                transform.rotation = Quaternion.Slerp(transform.rotation, newPos.Second, LerpSpeed);

                Ray        ray = new Ray(transform.position, transform.forward);
                RaycastHit hit = new RaycastHit();
                hit.point = ray.GetPoint(MaxRayDistance);

                if (Physics.Raycast(ray, out hit, MaxRayDistance, LayerMask.GetMask("Default", "Player"), QueryTriggerInteraction.Ignore))
                {
                    PlayerManager player = hit.collider.GetComponent <PlayerManager>();
                    if (player != null)
                    {
                        player.DealDamageFromAnyClient(SpellDamage * Time.deltaTime);///photonView.RPC("DamagePlayer", PhotonTargets.Others, p.owner);
                    }
                }
                photonView.RPC("SetRay", PhotonTargets.All, hit.point);

                MagicScript.AddOverload(SpellIndex, SelfSpellOverloadPerSecond * Time.deltaTime);

                if (MagicScript.SpellOverloads[SpellIndex] > OverloadThreshold)
                {
                    PhotonNetwork.Destroy(gameObject);
                }
            }
        }
 // Use this for initialization
 void Start()
 {
     mMaster = FindObjectOfType <MagicMaster>();
     mMaster.AddToLimitList(this.gameObject);
     mScript = GetComponent <MagicScript>();
 }
Exemple #10
0
 private void Awake()
 {
     Anim = GetComponent <Animator>();
     MGS  = GetComponent <MagicScript>();
 }