示例#1
0
	// Use this for initialization
	void Start () 
	{
		manager = transform.parent.gameObject.GetComponent<ArrowManager>();
		soundFX = GameObject.Find("SoundMistro").GetComponent<SoundFXManager>();
		renderer.enabled = false;
		collider.enabled = false;
	}
示例#2
0
 void OnDestroy()
 {
     if (this == Instance)
     {
         Instance = null;
     }
 }
 void OnDestroy()
 {
     if (inst)
     {
         inst = null;
     }
 }
示例#4
0
 void Awake()
 {
     if (null == Instance)
     {
         Instance = this;
     }
 }
示例#5
0
 // Start is called before the first frame update
 void Start()
 {
     TutorialCheck  = false;
     m_ArrowManager = GamemanagerGO.GetComponent <ArrowManager>();
     m_Player       = PlayerGO.GetComponent <Player>();
     StartCoroutine(TutorialStart());
 }
示例#6
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
示例#7
0
 private void Start()
 {
     transform.position = Vector3.zero;
     input = GetComponent <Inputs>();
     Research();
     arrowManager = GetComponent <ArrowManager>();
 }
示例#8
0
    private void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.tag == "playerProjectile" && spawned)
        {
            ArrowManager arrowManager = col.gameObject.GetComponent <ArrowManager>();
            TakeDamage(arrowManager.damage);
            Vector2 dir = (col.gameObject.transform.position - arrowManager.pos).normalized;

            if (dead)
            {
                //Vector2 dir = (col.gameObject.transform.position- arrowManager.pos).normalized;
                if (deadead == false)
                {
                    GetComponent <Rigidbody2D>().AddForce(dir * arrowManager.force);
                }
            }
            else
            {
                GetComponent <Rigidbody2D>().AddForce(dir * arrowManager.force * 2);
            }


            Destroy(col.gameObject);
        }
    }
示例#9
0
    /*void Update()
     * {
     * }*/

    void Start()
    {
//		Destroy (GameObject.Find ( "Main Camera Menu"));

        arrowManager = GetComponentInChildren <ArrowManager>();
        endUIScript  = GetComponentInChildren <EndUIScript>();
        timerScript  = GetComponentInChildren <TimerManager>();
        soundScript  = GetComponent <SoundScript>();

        HorsePowerApplied = horsePower;
        GetComponent <Rigidbody>().centerOfMass = Vector3.down * 1.5f;
        currentSpeed = 0.0f;

        //Compute the vertical and horizontal distance between the wheels in order to make some trigonometry for
        //wheels steer angles
        dv = Mathf.Abs(WheelLF.transform.position.x - WheelRB.transform.position.x);
        dh = Mathf.Abs(WheelLF.transform.position.z - WheelRB.transform.position.z);
        //Save the base position of both axle in order to modifiy it according to the suspension
        offsetAxleB = AxleBack.localPosition;
        offsetAxleF = AxleFront.localPosition;

        GameObject respawn = (GameObject)GameObject.FindGameObjectsWithTag("Respawn").GetValue(0);

        transform.position = respawn.transform.position;
        transform.rotation = respawn.transform.rotation;
        GetComponent <Rigidbody>().angularVelocity = Vector3.zero;

        timerScript.LaunchTimer();
        endUIScript.ResetTime();
    }
 void Awake()
 {
     if (!inst)
     {
         inst = this;
     }
 }
示例#11
0
 // Use this for initialization
 void Start()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
示例#12
0
 void OnDestroy()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
示例#13
0
 void Destroy()
 {
     if (Instance == this)
     {
         Instance = null;
     }
 }
示例#14
0
 //Closing of singleton
 private void OnDestroy()
 {
     if (Instance == this)
     {
         Instance = null;
     }
 }
示例#15
0
 void AssignArrowVariables(ArrowManager aS)
 {
     Physics.IgnoreCollision(wielder.states.capsule, aS.boxCollider);
     aS.damage        = wielder.states.rpg.GetDamage();
     aS.friendlyLayer = wielder.friendlyLayer;
     aS.rigidb.AddForce(aS.transform.forward * wielder.arrowLaunchForce);
     aS.ownerForward = wielder.transform.forward;
 }
示例#16
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     GetComponent <StaffManager> ().enabled = false;
 }
示例#17
0
    public static LaneMovementOrder CreateLaneMovementOrder(int colToMove, int rowToMove, Types.LaneMovementType dirToMove, int orderNumber)
    {
        GameObject newArrow = ArrowManager.SpawnArrowForLane(colToMove, rowToMove, dirToMove, orderNumber);

        LaneMovementOrder newOrder = new LaneMovementOrder(colToMove, rowToMove, dirToMove, newArrow);

        return(newOrder);
    }
示例#18
0
    private void Awake()
    {
        trackedObj = GetComponent <SteamVR_Behaviour_Pose>();

        if (Instance == null)
        {
            Instance = this;
        }
    }
示例#19
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     _as      = this.GetComponent <AudioSource>();
     _as.clip = arrowSound;
 }
示例#20
0
 void Start()
 {
     this.background   = GetComponentInChildren <Image>();
     this.text         = GetComponentInChildren <Text>();
     this.animator     = GetComponent <Animator>();
     this.arrowScript  = transform.parent.GetComponentInChildren <ArrowManager>();
     this.timerManager = transform.parent.GetComponentInChildren <TimerManager>();
     ResetTime();
 }
示例#21
0
    private void Awake()
    {
        levelManager         = FindObjectOfType <LevelManager>();
        arrowInputController = FindObjectsOfType <MonoBehaviour>().OfType <IArrowsInputController>().ToList();
        towerSelector        = FindObjectsOfType <MonoBehaviour>().OfType <ITowerSelector>().ToList();
        towerBuyController   = FindObjectsOfType <MonoBehaviour>().OfType <ITowerBuyController>().ToList();

        towerManager = GetComponent <TowerManager>();
        arrowManager = GetComponent <ArrowManager>();
    }
    //checking for closed fist
    //if(rightHandState == KinectInterop.HandState.Closed || rightHandState == KinectInterop.HandState.Unknown || rightHandState == KinectInterop.HandState.Lasso)

    //checking for open palm
    //if(rightHandState == KinectInterop.HandState.Open)

    private void Awake()
    {
        lr    = GetComponent <LineRenderer>();
        score = 0;
        //creating instance of self
        if (Instance == null)
        {
            Instance = this;
        }
    }
示例#23
0
 // Use this for initialization
 void Start()
 {
     cache_input        = GameManager.Instance.gmInputManager;
     cache_tf           = this.GetComponent <Transform>();
     cache_ridetf       = GameManager.Instance.gmRideScript.gameObject.GetComponent <Transform>();
     cache_ArrowM       = this.GetComponent <ArrowManager>();
     cameraAspectHalf.x = ((float)GameManager.Instance.gmPlayerCam.pixelWidth) * 0.5f;
     cameraAspectHalf.y = ((float)GameManager.Instance.gmPlayerCam.pixelHeight) * 0.5f;
     targetRot          = cache_tf.localRotation;
 }
示例#24
0
 private void Awake()
 {
     if (Manager == null)
     {
         Manager = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#25
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#26
0
 // Awake is called before Start
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     audio = GetComponent <AudioSource>();
     rightHandModel.SetActive(true);
     score    = 0;
     playerHP = 3;
 }
 private void Awake()
 {
     if (Instance != null && Instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         Instance = this;
     }
 }
示例#28
0
 //When created, tests that typeNumber is valid (sets to 0 if it isn't)
 //Then initiates this object as a singleton (only one can be active at
 //any time
 private void Awake()
 {
     if (typeNumber < 0 || typeNumber > arrowPrefab.Length - 1)
     {
         typeNumber = 0;
     }
     if (Instance == null)
     {
         Instance = this;
     }
 }
示例#29
0
    // Use this for initialization
    void Start()
    {
        instance = this;

        upArrows    = new Queue <Object>();
        downArrows  = new Queue <Object>();
        leftArrows  = new Queue <Object>();
        rightArrows = new Queue <Object>();

        lines    = File.ReadAllLines("Assets/Songs/easy/dontyouforget.txt");
        interval = float.Parse(lines[0]);
    }
示例#30
0
    // Use this for initialization
    void Start()
    {
        instance = this;

        upArrows = new Queue<Object>();
        downArrows = new Queue<Object>();
        leftArrows = new Queue<Object>();
        rightArrows = new Queue<Object>();

        lines = File.ReadAllLines("Assets/Songs/easy/dontyouforget.txt");
        interval = float.Parse(lines[0]);
    }
示例#31
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
    private void Start()
    {
        if ( instance == null ) {
            instance = this;

        } else if ( instance != this ) {
            Destroy(gameObject);

        }

        DontDestroyOnLoad(gameObject);
        CacheGameObjects();
    }
示例#33
0
    private void GenerateNextArrowManager()
    {
        var nextArrowManagerObj = Instantiate(_arrowManagerPrefab);
        var arrowManager        = nextArrowManagerObj.GetComponent <ArrowManager>();

        arrowManager.Level       = Level + 1;
        nextArrowManagerObj.name = "ArrowManager_Level" + arrowManager.Level;
        var newParentObject = new GameObject("ParentObject_Level" + arrowManager.Level);

        newParentObject.transform.position = ArrowParentGameObject.transform.position + _addPositionVector3;
        arrowManager.ArrowParentGameObject = newParentObject;
        NextArrowManager = arrowManager;
    }
 void OnDestroy()
 {
     if (Instance == this)
         Instance = null;
 }
 void Awake()
 {
     source = GetComponent<AudioSource>();
     if (Instance == null)
         Instance = this;
 }
示例#36
0
文件: Player.cs 项目: shadowpt/hs
        public override void Initialize()
        {
            // TODO: Add your initialization code here

            position = Matrix.Identity;

            Vector3 positionVector = Vector3.Zero;
            positionVector.Y = 0.7f;
            simulationState.Position = positionVector;
            simulationState.LastPositionVector = positionVector;

            simulationState.Velocity = Vector2.Zero;
            _maxVelocity = 12;

            simulationState.Rotation = 0;

            previousState = simulationState;
            displayState = simulationState;

            Matrix pos = Matrix.CreateTranslation(0, 0.7f, 0);
            _scale = Matrix.CreateScale(1.5f);
            world = world * _scale * pos;

            arrowKeysPressed = new List<Boolean>();
            for (int i = 0; i < 4; i++)
                arrowKeysPressed.Add(false);
            lastArrowKeysPressed = new List<Keys>();

            //lastPosition = new Vector3(0, 2, 0);
            stick = new BoundingSphere(new Vector3(2, 1f, 0), 0.5f);
            upBody = new BoundingSphere(new Vector3(0, 4.5f, 0), 1.2f);
            downBody = new BoundingSphere(new Vector3(0, 1.05f, -0.03f), 0.05f);

            CollisionManager cm = (CollisionManager)_gameManager.getGameEntity("collisionManager");
            DebugManager dm = (DebugManager)_gameManager.getGameEntity("debugManager");
            Ice ice = (Ice)_gameManager.getGameEntity("ice");
            ice.register(this);
            cm.register(this);
            dm.registerDebugEntities(this);

            MultiplayerManager mm = (MultiplayerManager)_gameManager.getGameEntity("multiplayerManager");
            if (mm != null)
                _disk = mm.getDisk();
            else
                _disk = (Disk)_gameManager.getGameEntity("disk");
            _arrowManager = (ArrowManager)_gameManager.getGameEntity("arrowManager");

            _deactivateKeyboard = false;

            _lastBouncePosition = Vector3.Zero;
            _keyDeactivated[(int)KeyboardKey.UP] = false;
            _keyDeactivated[(int)KeyboardKey.DOWN] = false;
            _keyDeactivated[(int)KeyboardKey.LEFT] = false;
            _keyDeactivated[(int)KeyboardKey.RIGHT] = false;

            base.Initialize();
        }