コード例 #1
0
ファイル: LaserAmmo.cs プロジェクト: OSUGameDev/LocalWar
    public void initialize(Vector3 direction, bool isServer)
    {
        damage = 15.0f;

        //If put the get function in Start then it will not execute properly
        line = GetComponent <LineRenderer>();

        destination = direction;
        line.SetPosition(0, origin);
        line.SetPosition(1, destination);

        if (!isServer)
        {
            return;
        }

        RaycastHit hit;

        if (Physics.Raycast(origin, destination - origin, out hit))
        {
            LifeSys target = hit.collider.gameObject.GetComponent <LifeSys>();
            if (target != null)
            {
                Debug.Log(maxRadius);
                target.InflictDamage(damage);
            }
        }
    }
コード例 #2
0
ファイル: LifeSys.cs プロジェクト: OSUGameDev/LocalWar
 void Start()
 {
     _health = 100.0f;
     _shield = 100.0f;
     if (hasAuthority)
     {
         playerLifeSystem = this;
     }
 }