Example #1
0
    public override void revert()
    {
        //remove effect


        //create homing heal bullet of destiny
        if (invokerVars.health <= 0)
        {
            GameObject   bul = Bullet.createBullet(invoker.gameObject, Resources.Load <GameObject> ("Prefabs/Bullets/BulletHomingHealth"), invoker.position, invoker.rotation);
            HomingBullet hb  = bul.GetComponent <HomingBullet> ();
            hb.faction      = Faction.NEUTRAL;
            hb.homingTarget = healTarget;
            hb.damage       = -healAmount;
        }
    }
    private void Attack(Collider target)
    {
        ammunition--;
        GameObject bullet = (GameObject)Instantiate(bulletTemplate);

        bullet.transform.position = bulletSpawnPoint.transform.position;

        HomingBullet component = bullet.GetComponent <HomingBullet>();

        component.target = target;
        component.damage = bulletDamage;
        component.speed  = bulletSpeed;
        component.force  = bulletForce;

        OnAttack(target);
    }
Example #3
0
    void Awake()
    {
        networkView = gameObject.GetComponent<NetworkView>();
        bullet = Resources.Load<HomingBullet>(bulletPath);
        Controller = gameObject.GetComponent<CharacterController>();

        //if(Controller == null)
            //Debug.LogWarning("OVRPlayerController: No CharacterController attached.");

        // We use OVRCameraRig to set rotations to cameras,
        // and to be influenced by rotation
        OVRCameraRig[] CameraControllers;
        CameraControllers = gameObject.GetComponentsInChildren<OVRCameraRig>();

        //if(CameraControllers.Length == 0)
            //Debug.LogWarning("OVRPlayerController: No OVRCameraRig attached.");
        //else if (CameraControllers.Length > 1)
            //Debug.LogWarning("OVRPlayerController: More then 1 OVRCameraRig attached.");
        //else
            CameraController = CameraControllers[0];

        DirXform = transform;

        //if(DirXform == null)
            //Debug.LogWarning("OVRPlayerController: ForwardDirection game object not found. Do not use.");
        networkView.RPC("Respawn", RPCMode.All, Network.player);
        #if UNITY_ANDROID && !UNITY_EDITOR
        OVRManager.display.RecenteredPose += ResetOrientation;
        #endif
    }