Example #1
0
 public void CatchWeapon(Transform ObjectParent)
 {
     _stickManMovement = ObjectParent.GetComponentInParent <StickManMovement>();
     _Parent           = ObjectParent;
     transform.SetParent(ObjectParent);
     transform.position = ObjectParent.position;
     isCatching         = true;
     _speed             = dropSpeed;
 }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     if (isCatching)
     {
         transform.rotation = _quaternion;
         //transform.rotation = _Parent.rotation;
         transform.localScale = _localScale;
     }
     if (_stickManMovement)
     {
         if (_stickManMovement._isReleasing)
         {
             transform.rotation = _Parent.rotation;
         }
         if (!isCatching && !_stickManMovement._isReleasing && transform.rotation != Quaternion.identity && _speed < 0)
         {
             if (_isSeeingRight)
             {
                 transform.rotation = Quaternion.identity;
             }
             else
             {
                 transform.rotation = new Quaternion(0, 180, 0, 0);
             }
         }
     }
     if (isDropOut)
     {
         Vector2 moveVector = new Vector2(0, 0);
         moveVector.x = _speed;
         if (_speed > 0)
         {
             _speed -= _dropTime * Time.deltaTime;
             transform.Translate(moveVector);
         }
         else
         {
             _Parent           = null;
             _stickManMovement = null;
             isDropOut         = false;
         }
     }
 }
 // Use this for initialization
 void Start()
 {
     _stickManMovement = player.GetComponent <StickManMovement>();
 }