예제 #1
0
 public void SoulVision()                           //鏡頭前進為靈視狀態
 {
     if (!Input.GetKey(KeyCode.E) && !IsPossessing) //只要在靈視狀態下放開靈視鍵則退出靈視
     {
         CameraState = "SoulVisionOver";
     }
     if (FowardAndBackTime < FowardStop)//0.25秒移動到到指定位置
     {
         SoulPower.SetActive(true);
         FowardAndBackTime += Time.deltaTime;
         VectorMoveDistance = MoveEnd.transform.position - NormalPosition;//距離為終點減正常位置
         Move = VectorMoveDistance * Time.deltaTime * 5;
         transform.position += Move;
         CameraNowPosition   = transform.position;
     }
     else if (FowardAndBackTime >= FowardStop)                           //到指定位置後開啟靈視效果和準心 並可以進入附身
     {
         NowCharacter.transform.rotation = Quaternion.Euler(0, rotX, 0); //靈視狀態下腳色轉動
         FowardAndBackTime  = FowardStop;
         CameraNowPosition  = MoveEnd.transform.position;
         transform.position = MoveEnd.transform.position;
         SoulVisionEffect.SetActive(true);
         Crosshairs.SetActive(true);
         CanPossess = true;
     }
 }
예제 #2
0
 private void InitializeComponents()
 {
     this.playerController = GetComponent <PlayerController>();
     this.gunController    = GetComponent <GunController>();
     this.mainCamera       = Camera.main;
     this.crosshairs       = crosshairPrefab.GetComponent <Crosshairs>();
 }
예제 #3
0
 void Start()
 {
     crosshair = FindObjectOfType <Crosshairs>();
     _shotsRemaingingInBurst = _burstCount;
     _muzzleFlash            = GetComponent <Muzzleflash>();
     _player = FindObjectOfType <Player>();
     _projectilesRemainingInMag = _projectilesPerMag;
 }
예제 #4
0
 void Start()
 {
     if (!isLocalPlayer)
     {
         return;
     }
     cam        = FindObjectOfType <Camera>();
     crosshairs = FindObjectOfType <Crosshairs>();
 }
예제 #5
0
        public void Add(List <Identifier> idents, string relPath)
        {
            var ident = idents.FirstOrDefault();

            if (ident == null)
            {
                ExtraFiles.Add(relPath);
                return;
            }
            if (ident is SkinIdentifier skinId)
            {
                var skinIds = idents.Cast <SkinIdentifier>().ToList();
                if (skinIds.Count > 1)
                {
                    MultiSkinFiles.Add(relPath, skinIds);
                }
                else
                {
                    Skins.Add(relPath, ident as SkinIdentifier);
                }
            }
            else if (ident is PortraitIdentifier)
            {
                Portraits.Add(relPath, idents.Cast <PortraitIdentifier>());
            }
            else if (ident is CrosshairIdentifier)
            {
                Crosshairs.Add(relPath, idents.Cast <CrosshairIdentifier>());
            }
            else if (ident is WeaponIdentifier)
            {
                Weapons.Add(relPath, idents.Cast <WeaponIdentifier>());
            }
            else if (ident is EffectsIdentifier)
            {
                Effects.Add(relPath, idents.Cast <EffectsIdentifier>());
            }
            else if (ident is CanopyIdentifier)
            {
                Canopies.Add(relPath, idents.Cast <CanopyIdentifier>());
            }
            else if (ident is EmblemIdentifier)
            {
                Emblems.Add(relPath, idents.Cast <EmblemIdentifier>());
            }
            else if (ident is CockpitIdentifier)
            {
                Cockpits.Add(relPath, idents.Cast <CockpitIdentifier>());
            }
        }
예제 #6
0
 public void OnLevelStart()
 {
     if (isLocalPlayer)
     {
         followCam  = GetComponent <FollowCamera> ();
         mainCamera = Camera.main;
         followCam.Intialise(mainCamera);
         crosshairs = Instantiate(crosshairsPrefab, Vector3.zero, Quaternion.Euler(-90, 0, 0));
     }
     if (healthBar != null)
     {
         healthBar.Initialise();
     }
 }
예제 #7
0
    public bool IsPossessing = false; //附身中為true直到附身結束切回正常狀態才會被重置為false


    // Use this for initialization
    void Start()
    {
        PossessedSystem = GameObject.Find("Pine").GetComponent <PossessedSystem>();
        SoulPower       = GameObject.Find("SoulPower");
        playerManager   = GameObject.Find("PlayerManager").GetComponent <PlayerManager>();
        SoulVisionEffect.SetActive(false);                 //開始時靈視關閉
        PossessEffect.SetActive(false);                    //開始時附身鏡頭關閉
        SoulPower.SetActive(false);                        //開始時靈視特效關閉
        Crosshairs.SetActive(false);                       //開始時準心關閉
        CameraState          = "NormalState";              //初始狀態為正常狀態
        AttachedBodyChildren = new Transform[3];           //只抓前四個物件(包含本身)
        PlayerView           = GameObject.Find("FirstPersonCamPoint");
        MoveEnd      = GameObject.Find("CamMoveEndPoint"); //一開始取正確腳色位置
        NowCharacter = GameObject.Find("Pine");
    }
예제 #8
0
 public void SoulVisionOver()//鏡頭後退為正常狀態
 {
     SoulPower.SetActive(false);
     SoulVisionEffect.SetActive(false);
     Crosshairs.SetActive(false);
     CanPossess = false;
     if (FowardAndBackTime > 0)//從移動到的位置退回正常位置
     {
         FowardAndBackTime -= Time.deltaTime;
         VectorMoveDistance = NormalPosition - CameraNowPosition;//距離為正常位置減當前位置
         Move = VectorMoveDistance * Time.deltaTime * 5;
         transform.position += Move;
     }
     else if (FowardAndBackTime <= 0)
     {
         CameraState = "NormalState";
     }
 }
예제 #9
0
    // Use this for initialization
    //protected override void Start ()
    public void Start()
    {
        this.GetComponent <LivingEntity>().OnStart();
        moveSpeed = PlayerPrefs.GetFloat("PlayerSpeed");
        GameUI gameUI = FindObjectOfType <GameUI>();

        gameUI.playerEntitity = this;

        controller    = GetComponent <PlayerController>();
        gunController = GetComponent <GunController>();
        viewCamera    = Camera.main;

        gunController.EquipGun(gunNumber++);

        gameUI.currentGunController = gunController;

        playerUIInstance      = Instantiate(playerUIPrefab);
        playerUIInstance.name = playerUIPrefab.name;
        this.crossHairs       = playerUIInstance.GetComponent <Crosshairs>();

        AddPlayer();
    }
예제 #10
0
        public static void SaveSettings(Form form, XmlNode parentNode, string key)
        {
            var emptyNodeAlways = Xml.GetEmptyNodeAlways(Xml.GetNodeAlways(parentNode, "ToolStripConfiguration"), key);

            Xml.SetNewValue(emptyNodeAlways, "Size", IconSize.ToString(CultureInfo.InvariantCulture));
            Xml.SetNewValue(emptyNodeAlways, "Locked", Locked.ToString());
            Xml.SetNewValue(emptyNodeAlways, "Crosshairs", Crosshairs.ToString());
            Xml.SetNewValue(emptyNodeAlways, "WaveformShown", WaveformShown.ToString());
            foreach (Control control in form.Controls)
            {
                var stripContainer = control as ToolStripContainer;
                if (stripContainer == null)
                {
                    continue;
                }
                WritePanel(emptyNodeAlways, stripContainer.TopToolStripPanel, "TopToolStripPanel");
                WritePanel(emptyNodeAlways, stripContainer.LeftToolStripPanel, "LeftToolStripPanel");
                WritePanel(emptyNodeAlways, stripContainer.RightToolStripPanel, "RightToolStripPanel");
                WritePanel(emptyNodeAlways, stripContainer.BottomToolStripPanel, "BottomToolStripPanel");
                break;
            }
        }
    // Use this for initialization
    public void Start()
    {
        playerController = GameObject.FindObjectOfType<PlayerController>();
        gunController = this.GetComponentInParent<GunMovement> ();

        if (this.gameObject.tag == "Weapon") {
            canPickup = false;
            Muzzle = GameObject.Find (this.gameObject.name + "Muzzle");
            bulletSpawn = GameObject.Find (this.gameObject.name + "BulletSpawn").transform;
            magazineSpawn = GameObject.Find (this.gameObject.name + "MagazineSpawn").transform;
            PrimaryGunSlot = GameObject.Find ("GunHolder");
            SecondaryGunSlot = GameObject.Find ("SecondGun");
            OutOfAmmo = false;
            ADS = false;
            isReloading = false;
            OutOfAmmo = false;
            MagazineDropped = false;
            isShotgun = false;
            isSniper = false;
            isAutomatic = false;
            CurrentRate = 0f;
            CurrentReloadRate = 0f;
            InitializeGuns (this.gameObject.name);
            crossHairs = GameObject.Find ("CH").GetComponent<Crosshairs> ();
        } else if (this.gameObject.tag == "Pickup") {
            pickUpText = GameObject.Find ("PickupText").GetComponent<Text>();
        }
    }
예제 #12
0
 void Start()
 {
     cam        = FindObjectOfType <Camera>();
     crosshairs = FindObjectOfType <Crosshairs>();
 }
 void Start()
 {
     weaponNames = new List<string>();
     weaponNames.Add("deagle");
     weaponNames.Add("SPAS 12");
     weaponNames.Add ("G36C");
     weaponNames.Add("Druganov");
     health = 100;
     gunSlots = new GameObject[2];
     AddWeapon("Gun", "G36C");
     AddWeapon ("Gun", "Druganov");
     if (gunSlots[0] != null)
     {
         currentWeapon = gunSlots[0];
     }
     if (gunSlots[1] != null) {
         secondaryWeapon = gunSlots[1];
     }
     gunMech = currentWeapon.GetComponentInChildren<GunMechanics>();
     forwards = 0f;
     right = 0f;
     jumpSpeed = 15.0f;
     movementSpeed = 0.03f;
     stoppingPower = 1.2f;
     maxSpeed = .15f;
     maxSprintSpeed = .20f;
     gravity = 0f;
     isSprinting = false;
     isGrounded = false;
     rigidBody = this.GetComponent<Rigidbody> ();
     crossHairs = GameObject.Find ("CH").GetComponent<Crosshairs> ();
     camera = GameObject.Find ("Main Camera").GetComponent<Camera>();
 }
예제 #14
0
 protected override void Start()
 {
     base.Start();
     crosshair = GameObject.FindObjectOfType <Crosshairs>();
 }