playMaker

Author Topic: Photon _isMine?  (Read 1364 times)

TESTLAB_INC

  • Playmaker Newbie
  • *
  • Posts: 6
Photon _isMine?
« on: March 05, 2015, 10:32:23 AM »
We've been playing around with the photon demo for quite some time now, We have wrote a simple script for our _controller which is really only recieving a click and a texture change, sync position and rotation over photon no animations required as of yet early development build, A example of what we trying to achieve is click a ball velocity in a forward fashion and change texture upon every click using OnMouseDown as developing for andriod, We have the behaivour triggering isControllable but there still seems to be input on other players/objects in the scene we've tryed to make a check to see if it isControllable but now it just skips that part of our code and changes the texture or sometimes skips the whole lot. Here is our script that we wrote in C-Sharp.

using UnityEngine;
using System.Collections;

public class MouseClick : MonoBehaviour {
   void Start ()
   {
      Random.seed = (int)Time.time;
   }
   
   public bool isControllable = true;

      
   void OnMouseDown(){
      if (isControllable ==true)
      {
         if (this.isControllable)
      rigidbody.AddForce(-transform.forward * 500);
      rigidbody.useGravity = true;
         
      
      float r = Random.Range(0f,1f);
      float g = Random.Range(0f,1f);
      float b = Random.Range(0f,1f);
      Color randomColour = new Color(r,g,b,1f);
      
      renderer.material.color = randomColour;
   }
  }
}


Your help would greatly be appreciated
Thanks in Advance  ;)
« Last Edit: March 05, 2015, 11:42:28 AM by TESTLAB_INC »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon _isMine?
« Reply #1 on: March 06, 2015, 01:33:17 AM »
Hi,

 What is your question of trouble with this? do you want to correct this script or do it in PlayMaker? or is it a problem with implementing this in photon?

 Bye,

 Jean