Esempio n. 1
0
 public void Init(InteractiveObj master)
 {
     Master    = master;
     RigidSelf = GetComponentInChildren <Rigidbody>();
     RigidSelf.GetComponent <SceneRotateWorldButton>().Init(this);
     RigidSelf.gameObject.SetActive(false);
     RigidFake = GetComponentInChildren <Rigidbody2D>();
     RigidFake.GetComponent <SceneRotateFakeButton>().Init(this);
     RigidFake.gameObject.SetActive(true);
     bindSkill = GetComponentInChildren <SkillBase>();
     if (bindSkill)
     {
         bindSkill.Init(master);
         Transform tsf = master.transform.Find("SkillStartPos");
         bindSkill.transform.SetParent(tsf ? tsf : master.BeAtkPoint, false);
     }
 }
Esempio n. 2
0
    private void ButtonAbandon()
    {
        if (!IsAlive)
        {
            return;
        }
        IsAlive = false;
        RigidSelf.transform.localRotation = RigidFake.transform.localRotation;
        RigidFake.gameObject.SetActive(false);
        RigidSelf.gameObject.SetActive(true);
        RigidSelf.AddRelativeForce(RigidFake.angularVelocity, 0, 0, ForceMode.Acceleration);
        RigidSelf.gameObject.SetLayer(1 << LayerMask.GetMask("Player"), true);
        Vector3    localPos       = transform.localPosition;
        Quaternion localRot       = RigidSelf.transform.localRotation;
        Transform  tsfSceneCamera = ThirdPersonPlayer.Instance.CameraController.transform;

        RigidSelf.transform.parent        = tsfSceneCamera;
        RigidSelf.transform.localPosition = localPos;
        RigidSelf.transform.localRotation = localRot;
        RigidSelf.transform.parent        = null;
        RigidSelf.constraints             = RigidbodyConstraints.None;
        //RigidSelf.transform.DOScale(new Vector3(2, 2, 2), 3);
        RigidSelf.AddForce(tsfSceneCamera.forward * 30 + Vector3.up * 10, ForceMode.VelocityChange);
    }
Esempio n. 3
0
 public void RotateBy(Quaternion deltaRot)
 {
     RigidSelf.MoveRotation(RigidSelf.rotation * deltaRot);
 }
Esempio n. 4
0
 public void MoveBy(Vector3 deltaPos)
 {
     RigidSelf.MovePosition(RigidSelf.position + deltaPos);
 }
Esempio n. 5
0
 public void RotateTo(Quaternion rot)
 {
     RigidSelf.MoveRotation(rot);
 }
Esempio n. 6
0
 public void MoveTo(Vector3 pos)
 {
     RigidSelf.MovePosition(pos);
 }