Esempio n. 1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Goal")
        {
            GameObject.Find("StageManager").GetComponent <StageManager>().StageClear();
        }
        else if (other.tag == "Enermy")
        {
            GameObject.Find("StageManager").GetComponent <StageManager>().Dieing();
            GameObject.Destroy(other);
        }
        else if (other.tag == "Item")
        {
            if (wh != null)
            {
                Destroy(transform.Find("Weapon").gameObject);
            }

            GameObject obj = Instantiate(other.GetComponentInParent <ItemHandle>().Weapon, transform);
            obj.name = "Weapon";
            wh       = obj.GetComponent <WeaponHandle>();
            GameObject.Destroy(other.transform.parent.gameObject);
        }
        Debug.Log(other.tag);
    }
Esempio n. 2
0
        private void Awake()
        {
            WeaponHandle weaponHandle = GetComponent <WeaponHandle>();

            Observable.EveryUpdate()
            .Where(_ => Input.GetKeyDown(KeyCode.Q))
            .Subscribe(_ => weaponHandle.ToggleWeapon());
        }
Esempio n. 3
0
 private void Start()
 {
     _player = GameObject.FindGameObjectWithTag("Player");
     if (_player != null)
     {
         _playerWeaponSettings = _player.GetComponent <WeaponHandle> ();
     }
 }
Esempio n. 4
0
    // Start is called before the first frame update
    void Start()
    {
        cc  = GetComponent <CharacterController>();
        wh  = GetComponentInChildren <WeaponHandle>();
        ani = GetComponent <Animation>();

        keyinput = new Vector3();
        jumpGage = 0.3f;
    }
Esempio n. 5
0
 private void CheckIfEverythingIsFine()
 {
     if (_playerWeaponSettings != null)
     {
         return;
     }
     try { _playerWeaponSettings = _player.GetComponent <WeaponHandle>(); }
     catch
     {
         // ignored
     }
 }
        private void Awake()
        {
            WeaponHandle weaponHandle = GetComponent <WeaponHandle>();

            foreach (var weaponConfig in playerInitialWeaponSetup.Weapons)
            {
                Weapon newWeapon = WeaponObjectCreator.Create(weaponConfig);
                AddImpulseSource(newWeapon, weaponConfig);
                weaponHandle.AttachNewWeapon(newWeapon);
            }

            weaponHandle.Initialize();
        }
Esempio n. 7
0
        public void SetUp(WeaponChance weapon)
        {
            gameObject.AddComponent <WeaponBase> ().type = (WeaponType)weapon.weaponType;

            WeaponBase wb = GetComponent <WeaponBase> ();

            blade  = transform.GetChild(0).gameObject;
            handle = transform.GetChild(1).gameObject;

            if (handle == null || blade == null)
            {
                Debug.LogError("BLADE OR HANDLE IS MISSING!");
                return;
            }

            handle.AddComponent <WeaponHandle> ();

            WeaponHandle wh = handle.GetComponent <WeaponHandle> ();

            wb.grabbable    = wh;
            wb.canParry     = weapon.canPary;
            wb.canBeParried = weapon.canBeParried;
            wb.addForceToRigidbodyFactor = weapon.addForceToRigidbodyFactor;

            wh.grabRigidbody       = wh.GetComponent <Rigidbody> ();
            wh.hideHandModelOnGrab = weapon.hideHandOnGrab;
            wh.isCurrentlyGrabbale = weapon.isCurrentlyGrabbable;
            wh.setPositionOnGrab   = weapon.setPositionOnGrab;
            wh.setRotationOnGrab   = weapon.setRotationOnGrab;

            DamagerRigidbody drb = blade.AddComponent <DamagerRigidbody> ();

            drb.scaleDamage   = weapon.scaleDamage;
            drb.canAlsoCut    = weapon.canAlsoCut;
            drb.bonusVelocity = weapon.bonusVelocity;
            drb.isDamaging    = weapon.isDamaging;
            drb.impaleDepth   = weapon.impaleDepth;
            drb.damageType    = (DamageType)weapon.damageType;

            handle.AddComponent <FootStepSound> ().soundEffectName    = "WeaponDrop";
            handle.GetComponent <FootStepSound> ().minVolumeToTrigger = 0.05f;

            try {
                if (transform.GetChild(2) != null)
                {
                    drb.heartStabPoint = transform.GetChild(2);

                    drb.impaledBreakForce             = weapon.impaleBreakForce;
                    drb.impaledZDamper                = weapon.impaleZDamper;
                    drb.impaledConnectedBodyMassScale = weapon.connectedBMass;
                }
            }
            catch {
                return;
            }

            /*
             * BezierConnector bc = blade.AddComponent<BezierConnector> ();
             *
             * bc.midPoints = new Transform[4] { blade.transform.GetChild(2), blade.transform.GetChild ( 2 ).GetChild(0), blade.transform.GetChild ( 2 ).GetChild(0).GetChild(0), blade.transform.GetChild ( 2 ).GetChild ( 0 ).GetChild ( 0 ).GetChild(0) };
             *
             * bc.orientTransforms = true;
             *
             * bc.end = blade.transform.GetChild(1);
             * bc.origin = blade.transform.GetChild(0);
             * bc.clampAngleTo = 30;
             */
            return;
        }
Esempio n. 8
0
 // Start is called before the first frame update
 void Start()
 {
     cc = GetComponent <CharacterController>();
     wh = GetComponentInChildren <WeaponHandle>();
 }